question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Helidon SE: use jlink to create minimal Java 11 runtime

See original GitHub issue

Environment Details

  • Helidon Version: 0.10.4
  • Helidon SE
  • JDK version: 11

Problem Description

We should determine the minimum set of modules needed to run a Helidon SE application and document it. Also, we should consider updating our quickstart Dockerfile to generate the JRE as part of a two stage docker build.

I did a quick experimentation and this seems to work, but I did not exercise very many code paths:

$JAVA_HOME/bin/jlink --compress=2 --output jre --add-modules java.base,java.logging,java.sql,java.desktop,java.management

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
barchettacommented, Nov 2, 2018

Example Dockerfile to generate image with custom JRE:

# Multistage docker build.
# Stage 1: Build custom Java 11 JRE and put it in /var/tmp/myjre
FROM openjdk:11-slim AS build
RUN ["jlink", "--compress=2", \
     "--add-modules", "java.base,java.logging,java.sql,java.desktop,java.management", \
     "--output", "/var/tmp/myjre"]

# Stage 2: Build application image using JRE from Stage 1
FROM debian:sid-slim
COPY --from=build /var/tmp/myjre /opt/jre
ENV PATH=$PATH:/opt/jre/bin

RUN mkdir /app
COPY libs /app/libs
COPY ${project.artifactId}.jar /app

CMD ["java", "-jar", "/app/${project.artifactId}.jar"]
0reactions
barchettacommented, Nov 15, 2018

This is being documented in PR #182

Read more comments on GitHub >

github_iconTop Results From Across the Web

Helidon SE: use jlink to create minimal Java 11 runtime #130
Environment Details Helidon Version: 0.10.4 Helidon SE JDK version: 11 Problem Description We should determine the minimum set of modules ...
Read more >
Using jlink to customize Java runtime environment OpenJDK 11
Using jlink, you can create a custom runtime environment that only includes the relevant class file. Chapter 2. Creating a custom Java runtime...
Read more >
Lab 12: jlink
In a nutshell, jlink is a tool that can create custom Java runtimes that include only the modules required by an application.
Read more >
2 Your first application - Helidon in Action MEAP V01
Creating a Helidon application using Command Line Interface (CLI) and using Maven Archetypes; Building executable jar, JLink optimized JVM and GraalVM ...
Read more >
Helidon 3.0 Introduces Project Starter and Requires Java 17 ...
Helidon has officially supported native Java with GraalVM in production for years, like Quarkus and Micronaut. Spring Boot 3.0, planned for a GA ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found