Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,22 @@ RUN apk add --no-cache \

ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}"

ARG JLINK_MODULES

Comment on lines +46 to +47
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ARG JLINK_MODULES

See above

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 ;; \
# JDK 25 switches to a minimal module set for smaller images. Override with JLINK_MODULES to restore broader compatibility if needed.
"25"*) mod_list="${JLINK_MODULES:-java.base,java.logging,java.xml,java.management,java.net.http,jdk.crypto.ec}"; \
set -- "--compress=zip-6" --add-modules "$mod_list" ;; \
Comment on lines +51 to +53
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# JDK 25 switches to a minimal module set for smaller images. Override with JLINK_MODULES to restore broader compatibility if needed.
"25"*) mod_list="${JLINK_MODULES:-java.base,java.logging,java.xml,java.management,java.net.http,jdk.crypto.ec}"; \
set -- "--compress=zip-6" --add-modules "$mod_list" ;; \
# JDK 25 switches to a minimal module set for smaller images
"25"*) set -- "--compress=zip-6" --add-modules "java.base,java.logging,java.xml,java.management,java.net.http,jdk.crypto.ec" ;; \

Let's keep in simple for now like what's in the docker-agent which already has JDK25 images.

*) 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
27 changes: 15 additions & 12 deletions debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,25 @@ RUN set -x; apt-get update \

ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}"

ARG JLINK_MODULES

Comment on lines +45 to +46
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ARG JLINK_MODULES

ditto

# Generate smaller java runtime without unneeded files
# 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 ;; \
# JDK 25 switches to a minimal module set for smaller images. Override with JLINK_MODULES to restore broader compatibility if needed.
"25"*) mod_list="${JLINK_MODULES:-java.base,java.logging,java.xml,java.management,java.net.http,jdk.crypto.ec}"; \
set -- "--compress=zip-6" --add-modules "$mod_list" ;; \
Comment on lines +53 to +55
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# JDK 25 switches to a minimal module set for smaller images. Override with JLINK_MODULES to restore broader compatibility if needed.
"25"*) mod_list="${JLINK_MODULES:-java.base,java.logging,java.xml,java.management,java.net.http,jdk.crypto.ec}"; \
set -- "--compress=zip-6" --add-modules "$mod_list" ;; \
# JDK 25 switches to a minimal module set for smaller images
"25"*) set -- "--compress=zip-6" --add-modules "java.base,java.logging,java.xml,java.management,java.net.http,jdk.crypto.ec" ;; \

ditto

*) 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"
Copy link
Member

@lemeurherve lemeurherve Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default = "25+9-ea-beta"
default = "25_36"

Let's directly use the GA version and skip the EA beta altogether.

Could you rename your PR if you accept this suggestion please?
feat: add JDK25 Linux images

}

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