-
-
Notifications
You must be signed in to change notification settings - Fork 180
feat(linux): add support on Linux for JDK 25 preview in Docker build configurations #549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -43,19 +43,22 @@ RUN apk add --no-cache \ | |||||||||||
|
||||||||||||
ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}" | ||||||||||||
|
||||||||||||
ARG JLINK_MODULES | ||||||||||||
|
||||||||||||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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 | ||||||||||||
|
||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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}" | ||||||||||||
|
||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -32,6 +32,10 @@ group "linux-ppc64le" { | |||||
} | ||||||
|
||||||
variable "jdks_to_build" { | ||||||
default = [17, 21, 25] | ||||||
} | ||||||
|
||||||
variable "jdks_to_build_windows" { | ||||||
default = [17, 21] | ||||||
} | ||||||
|
||||||
|
@@ -71,6 +75,10 @@ variable "JAVA21_VERSION" { | |||||
default = "21.0.8_9" | ||||||
} | ||||||
|
||||||
variable "JAVA25_VERSION" { | ||||||
default = "25+9-ea-beta" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Let's directly use the GA version and skip the EA beta altogether. Could you rename your PR if you accept this suggestion please? |
||||||
} | ||||||
|
||||||
variable "DEBIAN_RELEASE" { | ||||||
default = "trixie-20250908" | ||||||
} | ||||||
|
@@ -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 | ||||||
|
@@ -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}" | ||||||
|
@@ -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}" | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above