Visit Azul.com Support

Running Azul Zulu CA with Paketo Buildpacks

Community Availability (CA) distributions are Azul Zulu Builds of OpenJDK that are free to download and use.

Paketo Buildpacks implement the Cloud Native Buildpacks (CNB) specification and produce OCI container images without requiring a Dockerfile. The Paketo Buildpack for Azul Zulu paketo-buildpacks/azul-zulu provides the Azul Zulu CA JRE and JDK as the JVM layer in Paketo-built images. This Buildpack is maintained by the community.

Prerequisites

  • Java application with a Maven or Gradle build

  • Docker installed and running

For Spring Boot projects, no additional tools are required. For non-Spring Boot projects, also install the buildpack CLI.

Using Spring Boot with Paketo

The Spring Boot Maven Plugin and Gradle Plugin support Paketo buildpacks natively through the build-image goal. To use Azul Zulu CA, add paketobuildpacks/azul-zulu explicitly, placed before paketobuildpacks/java. This order is important as Paketo uses the first matching JVM buildpack.

Minimal Configuration

Add the Spring Boot Maven Plugin to your pom.xml:

 
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>${your.mainClass}</mainClass> <image> <buildpacks> <buildpack>paketobuildpacks/azul-zulu</buildpack> <buildpack>paketobuildpacks/java</buildpack> </buildpacks> </image> </configuration> </plugin> </plugins> </build>

Build the container image:

 
$ mvn spring-boot:build-image

The build output confirms the Azul Zulu buildpack is in use:

 
[INFO] > Pulling buildpack image 'docker.io/paketobuildpacks/azul-zulu:latest' 100% [INFO] [creator] Paketo Buildpack for Azul Zulu 11.6.1 [INFO] [creator] https://github.com/paketo-buildpacks/azul-zulu [INFO] [creator] Azul Zulu JRE 21.x.y: Contributing to layer

Configuring the JVM Version and Type

To pin a specific Java version or request a JDK instead of the default JRE, add a <configuration> block to the plugin:

 
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <image> <buildpacks> <buildpack>paketobuildpacks/azul-zulu</buildpack> <buildpack>paketobuildpacks/java</buildpack> </buildpacks> <env> <!-- Java version: 8, 11, 17, 21, 25 --> <BP_JVM_VERSION>21</BP_JVM_VERSION> <!-- Runtime type: JRE (default, smaller) or JDK --> <BP_JVM_TYPE>JRE</BP_JVM_TYPE> </env> </image> </configuration> </plugin>

Using Gradle

For Gradle builds, set the environment variables in the bootBuildImage task:

 
tasks.named("bootBuildImage") { buildpacks = ["paketobuildpacks/azul-zulu", "paketobuildpacks/java"] environment = [ "BP_JVM_VERSION": "21", "BP_JVM_TYPE": "JRE" ] }

Using the pack CLI (Without Spring Boot)

Any JVM application can use the Paketo Azul Zulu buildpack through the pack CLI.

 
$ pack build my-container \ --path target/my-jar.jar \ --buildpack docker://paketobuildpacks/azul-zulu \ --buildpack docker://paketobuildpacks/java \ --builder paketobuildpacks/builder-jammy-java-tiny

You can pass build-time environment variables with --env:

 
$ pack build my-container \ --path target/my-app.jar \ --buildpack docker://paketobuildpacks/azul-zulu \ --buildpack docker://paketobuildpacks/java \ --builder paketobuildpacks/builder-jammy-java-tiny \ --env BP_JVM_VERSION=21 \ --env BP_JVM_JLINK_ENABLED=true

Configuration Reference

Build-Time Variables (BP_)

These variables configure the buildpack during image assembly.

Variable Description Default

BP_JVM_VERSION

JVM version: 8, 11, 17, 21, 25

Latest LTS

BP_JVM_TYPE

Runtime type: JDK or JRE

JRE

BP_JVM_JLINK_ENABLED

Run jlink to generate a custom JRE

false

BP_JVM_JLINK_ARGS

Custom arguments passed to jlink

--no-man-pages --no-header-files --strip-debug --compress=1

Launch-Time Variables (BPL_)

These variables configure the JVM behaviour at startup of the container. You can set them as environment variables when running the container, or bake them into the image using BPE_DEFAULT_ prefixes in the plugin configuration.

For the full and up-to-date list of BPL_ variables, see the Configuration section of the Paketo Buildpack for Azul Zulu README on GitHub.

Pass a BPL_ variable at container startup with the -e flag, for example:

 
$ docker run --rm -p 8080:8080 \ -e BPL_DEBUG_ENABLED=true \ -e BPL_DEBUG_PORT=8000 \ -p 8000:8000 \ my-app

Baking Launch-Time Variables into the Image

To set default values for BPL_ variables so that the container does not require explicit flags at runtime, use BPE_DEFAULT_ prefixes:

 
<env> <!-- Baked into the image: remote debugging on by default --> <BPE_DEFAULT_BPL_DEBUG_ENABLED>true</BPE_DEFAULT_BPL_DEBUG_ENABLED> <BPE_DEFAULT_BPL_DEBUG_PORT>8000</BPE_DEFAULT_BPL_DEBUG_PORT> </env>

Setting BP_JVM_JLINK_ENABLED=true instructs the buildpack to run jlink during image assembly. The resulting image contains only the Java modules your application requires.

 
<env> <BP_JVM_VERSION>25</BP_JVM_VERSION> <BP_JVM_JLINK_ENABLED>true</BP_JVM_JLINK_ENABLED> </env>

For typical Spring Boot applications, the image size can drop several hundreds of MB when you switch from a full JRE to a runtime generated with jlink. Applications that rely on reflection-based frameworks like Spring Boot or Hibernate should test the jlink output carefully, as jdeps may not detect all required modules automatically.