Skip to content
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

Generate smaller java runtime with jlink in Windows images #788

Open
lemeurherve opened this issue Apr 17, 2024 · 2 comments
Open

Generate smaller java runtime with jlink in Windows images #788

lemeurherve opened this issue Apr 17, 2024 · 2 comments

Comments

@lemeurherve
Copy link
Member

What feature do you want to see added?

Generate smaller java runtime without unneeded files like it's done in Linux images:

# 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 if test "${TARGETPLATFORM}" != 'linux/arm/v7'; then \
case "$(jlink --version 2>&1)" in \
# jlink version 11 has less features than JDK17+
"11."*) strip_java_debug_flags=("--strip-debug") ;; \
*) strip_java_debug_flags=("--strip-java-debug-attributes") ;; \
esac; \
jlink \
--add-modules ALL-MODULE-PATH \
"${strip_java_debug_flags[@]}" \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /javaruntime; \
# It is acceptable to have a larger image in arm/v7 (arm 32 bits) environment.
# Because jlink fails with the error "jmods: Value too large for defined data type" error.
else cp -r /opt/java/openjdk /javaruntime; \
fi

Upstream changes

No response

Are you interested in contributing this feature?

Yes, I've already implemented it while working on #787

@lemeurherve
Copy link
Member Author

I haven't open any PR yet as introducing jlink on Windows requires additional tests to ensure the absence of regressions.

@lemeurherve
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant