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.

Provide ubi-minimal with java installed

See original GitHub issue

Description The current standard Quarkus JVM Dockerfile (as of provided by code.quarkus.io) is based on the registry.access.redhat.com/ubi8/ubi-minimal:8.1 image. Since this image does not include java and an updated microdnf, it always takes quite a while to build the first layers of this image. This is especially true for our CI builds, as they don’t always have the previous layers cached (mutliple machines) and thus we have longer build times than needed.

Therefore, I would like to propose to provide something like a ubi-minimal-java:8.1-java11 or even a ubi-minimal-quarkus:8.1-quarkus1.5.2 image that includes everything of the standard JVM Dockerfile up until the actual application libraries are copied into the container.

Implementation ideas Automatically build a regularly updated version with the main part of the standard quarkus jvm Dockerfile (see below) and publish it on a docker repository.

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1

ARG JAVA_PACKAGE=java-11-openjdk-headless
ARG RUN_JAVA_VERSION=1.3.8

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'

# Install java and the run-java script
# Also set up permissions for user `1001`
RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
    && microdnf update \
    && microdnf clean all \
    && mkdir /deployments \
    && chown 1001 /deployments \
    && chmod "g+rwX" /deployments \
    && chown 1001:root /deployments \
    && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
    && chown 1001 /deployments/run-java.sh \
    && chmod 540 /deployments/run-java.sh \
    && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security

# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
alexsanzdevcommented, Aug 29, 2020

Not sure if this solves the initial issue, but we’re running Quarkus on Java 14 on a ubi-minimal (8.2) based image by Eclipse Adoptium (AdoptOpenJDK), adoptopenjdk/openjdk14:jre-14.0.2_12-ubi-minimal.

Here’s our slightly modified Dockerfile

FROM adoptopenjdk/openjdk14:jre-14.0.2_12-ubi-minimal

ARG RUN_JAVA_VERSION=1.3.8

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'

# Install java and the run-java script
# Also set up permissions for user `1001`
RUN microdnf install curl ca-certificates \
    && microdnf update \
    && microdnf clean all \
    && mkdir /deployments \
    && chown 1001 /deployments \
    && chmod "g+rwX" /deployments \
    && chown 1001:root /deployments \
    && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
    && chown 1001 /deployments/run-java.sh \
    && chmod 540 /deployments/run-java.sh \
    && echo "securerandom.source=file:/dev/urandom" >> $JAVA_HOME/lib/security/java.security

# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"

COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/app.jar

EXPOSE 8080
USER 1001

ENTRYPOINT [ "/deployments/run-java.sh" ]
3reactions
andreas-eberlecommented, Jul 15, 2020

Furthermore, it would be interesting to have a Java 14 version as well. If I understand correctly, Quarkus should run on Java 14, am I right? Unfortunately, I wasn’t able to figure out how to install Java 14 with microdnf. Simply updating the java-11-openjdk-headless to java-14-openjdk-headless does not work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ubi8/ubi-minimal - Certified Container Image
The Universal Base Image Minimal is a stripped down image that uses microdnf as a package manager. This base image is freely redistributable,...
Read more >
ngacareer/ubi-minimal-java - Docker Image
What is ubi-minimal-java ? The image is created from The Universal Base Image Minimal by Red Hat. UBI can take advantage of Red...
Read more >
Quarkus Base Runtime Image
First stage - install the dependencies in an intermediate container FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6 as BUILD RUN microdnf install ...
Read more >
Java is available for installation from the base UBI image
Java is available for installation from the base UBI image: $ docker run --rm registry.access.redhat.com/ubi8/ubi yum search openjdk ...
Read more >
Executing command-line calls inside a Docker container from ...
The image is based on the ubi-minimal image provided by RedHat. ... UTF-8' LANGUAGE='en_US:en' # Install java and the run-java script # Also ......
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