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

Please support plugin to generate java runtime for Java application #824

Open
vpa1977 opened this issue Aug 20, 2024 · 0 comments
Open

Please support plugin to generate java runtime for Java application #824

vpa1977 opened this issue Aug 20, 2024 · 0 comments
Labels
Enhancement New feature or request

Comments

@vpa1977
Copy link
Contributor

vpa1977 commented Aug 20, 2024

What needs to get done

Java runtime plugin generates java runtime using jdeps/jlink tools.

Prerequisites:

  • JDK is installed in the build image
  • ca-certificates-java installed in the build image
  • Application Jar files are located in $CRAFT_STAGE/jars/

Operations:

  • unpack jar files to a temporary location
  • Build classpath using jars found in temporary location (spring packages dependencies under BOOT-INF/
  • run jdeps against jars in $CRAFT_STAGE/jars/ using classpath from the step above
  • run jlink and deploy image into /usr/lib/jvm/java--openjdk-
  • link java under /usr/bin/java
  • java cacerts copied into staging area and symlinked to openjdk

Why it needs to get done

Jlink allows to link lean Java runtime images that only contain components of Java runtime required by the application.
Java provided by Ubuntu archive contains all the modules in lib/modules file (200mb). This can go down to as small as 27mb for java.base.
This both reduces attack surface of the Java application and reduces the deployment size.

@vpa1977 vpa1977 added the Enhancement New feature or request label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant