salesforce / salesforce/rules_spring

Create a minified application JRE using jlink

Open
#96 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Starlark
Stars
257
Forks
58
PR merge metrics
No merged PRs in 30d

Description

This could be a good middle ground between our current standard deployment artifact, and the GraalVM/SpringNative optimized executable (see #93). This would be an optional add-on, perhaps as a distinct rule, something like:


springboot(name = 'glory_svc', ...)

springboot_jre(name = 'glory_svc_jre', springboot_app = ':glory_svc',...)

java_docker_image(name 'glory_docker', app = ':glory_svc', jdk = ':glory_svc_jre', ...)

With the JDK jlink tool, we should be able to produce a small JDK+app executable. In one published example, this reduced the size of the runnable jre from 286MB to 39MB. This works because the jre distro will only contain the Java platform modules that are needed to run the app, and not all the extra cruft (corba, rmi, etc) that are not.

https://medium.com/azulsystems/using-jlink-to-build-java-runtimes-for-non-modular-applications-9568c5e70ef4

There are a few examples of Spring Boot users getting this to work online, but all of them seemed to use manual methods. Because we have the full list of deps for the Spring Boot jar, we could invoke jdeps with high fidelity, and use that when invoking jlink.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing springboot and java_docker_image rules referenced in the proposal, then investigate how jdeps and jlink could use the Spring Boot dependency list. Done means an optional springboot_jre rule can produce a minimized Java runtime for use by the Docker image rule, with its interface and behavior defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.