Skip to content
23 changes: 11 additions & 12 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,17 @@ RUN apk add --no-cache \
ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}"

RUN case "$(jlink --version 2>&1)" in \
"17."*) set -- "--compress=2" ;; \
# the compression argument is different for JDK21
"21."*) set -- "--compress=zip-6" ;; \
*) echo "ERROR: unmanaged jlink version pattern" && exit 1 ;; \
esac; \
jlink \
--strip-java-debug-attributes \
"$1" \
--add-modules ALL-MODULE-PATH \
--no-man-pages \
--no-header-files \
--output /javaruntime
"17."*) set -- "--compress=2" --add-modules ALL-MODULE-PATH ;; \
"21."*) set -- "--compress=zip-6" --add-modules ALL-MODULE-PATH ;; \
"25"*) set -- "--compress=zip-6" --add-modules java.base,java.logging,java.xml,java.se ;; \
*) echo "ERROR: unmanaged jlink version pattern" && exit 1 ;; \
esac; \
jlink \
--strip-java-debug-attributes \
"$@" \
--no-man-pages \
--no-header-files \
--output /javaruntime

FROM alpine:"${ALPINE_TAG}" AS build

Expand Down
23 changes: 11 additions & 12 deletions debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,17 @@ ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}"
# for now we include the full module path to maintain compatibility
# while still saving space (approx 200mb from the full distribution)
RUN case "$(jlink --version 2>&1)" in \
"17."*) set -- "--compress=2" ;; \
# the compression argument is different for JDK21
"21."*) set -- "--compress=zip-6" ;; \
*) echo "ERROR: unmanaged jlink version pattern" && exit 1 ;; \
esac; \
jlink \
--strip-java-debug-attributes \
"$1" \
--add-modules ALL-MODULE-PATH \
--no-man-pages \
--no-header-files \
--output /javaruntime
"17."*) set -- "--compress=2" --add-modules ALL-MODULE-PATH ;; \
"21."*) set -- "--compress=zip-6" --add-modules ALL-MODULE-PATH ;; \
"25"*) set -- "--compress=zip-6" --add-modules java.base,java.logging,java.xml,java.se ;; \
*) echo "ERROR: unmanaged jlink version pattern" && exit 1 ;; \
esac; \
jlink \
--strip-java-debug-attributes \
"$@" \
--no-man-pages \
--no-header-files \
--output /javaruntime

FROM debian:"${DEBIAN_RELEASE}"

Expand Down
22 changes: 16 additions & 6 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ group "linux-ppc64le" {
}

variable "jdks_to_build" {
default = [17, 21, 25]
}

variable "jdks_to_build_windows" {
default = [17, 21]
}

Expand Down Expand Up @@ -71,6 +75,10 @@ variable "JAVA21_VERSION" {
default = "21.0.8_9"
}

variable "JAVA25_VERSION" {
default = "25+9-ea-beta"
}

variable "DEBIAN_RELEASE" {
default = "trixie-20250908"
}
Expand All @@ -92,16 +100,18 @@ function "javaversion" {
params = [jdk]
result = (equal(17, jdk)
? "${JAVA17_VERSION}"
: "${JAVA21_VERSION}")
: equal(21, jdk)
? "${JAVA21_VERSION}"
: "${JAVA25_VERSION}")
}

## Specific functions
# Return an array of Alpine platforms to use depending on the jdk passed as parameter
function "alpine_platforms" {
params = [jdk]
result = (equal(21, jdk)
? ["linux/amd64", "linux/arm64"]
: ["linux/amd64"])
result = (equal(17, jdk)
? ["linux/amd64"]
: ["linux/amd64", "linux/arm64"])
}

# Return an array of Debian platforms to use depending on the jdk passed as parameter
Expand Down Expand Up @@ -191,7 +201,7 @@ target "debian" {

target "nanoserver" {
matrix = {
jdk = jdks_to_build
jdk = jdks_to_build_windows
windows_version = windowsversions("nanoserver")
}
name = "nanoserver-${windows_version}_jdk${jdk}"
Expand All @@ -216,7 +226,7 @@ target "nanoserver" {

target "windowsservercore" {
matrix = {
jdk = jdks_to_build
jdk = jdks_to_build_windows
windows_version = windowsversions("windowsservercore")
}
name = "windowsservercore-${windows_version}_jdk${jdk}"
Expand Down