Adding JDK and other packages directly onto Application Containers using APT buildpack
search cancel

Adding JDK and other packages directly onto Application Containers using APT buildpack

book

Article ID: 391869

calendar_today

Updated On:

Products

VMware Tanzu Application Service

Issue/Introduction

This KB article goes over the process of adding JDK packages onto an application container using the APT buildpack (https://github.com/cloudfoundry/apt-buildpack).

In general, you can bundle other packages other than JDK packages.

Environment

Tanzu Application Service

Resolution

  1. Download a Spring Cloudfoundry sample application. In this example, we will choose the spring-music application: 
  1. Create an apt.yml file in the spring-music folder:
---
packages:
- openjdk-8-jdk-headless
  1. Build the spring-music application:
./gradlew clean assemble
  1. Bundle the apt.yml file with the jar file:
jar uf build/libs/spring-music-1.0.jar ./apt.yml
  1. Verify that the apt.yml file has been added to the application JAR:
jar tf build/libs/spring-music-1.0.jar | grep 'apt.yml'
  1. Push the application using the apt buildpack AND the Java buildpack. More information about the apt buildpack can be found here
cf push -b https://github.com/cloudfoundry/apt-buildpack/releases/download/v0.3.9/apt-buildpack-cflinuxfs4-v0.3.9.zip -b java_buildpack_offline
  1. SSH into the application container
cf ssh spring-music
  1. Confirm that the openjdk-8-headless package has been added to the application dependencies folder: