Skip to content

Commit a11fcef

Browse files
committed
Clean up templates/jlink/Dockerfile
For clarity. Signed-off-by: Jonathan Dowland <[email protected]>
1 parent c0e8b65 commit a11fcef

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

templates/jlink/Dockerfile

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
#multi-stage build for jlinked application JAR and JRE
22

3-
#Stage-1:build application JAR and libraries
4-
#steps to build the application JAR and jlinked JRE
5-
#for time being using the image built by Jon
3+
#Stage-1: ubi9-jlinked-image is builder image + application + jlinked JVM
4+
# install additional system dependencies (for ubi-micro) to /mnt/jrootfs
65
FROM ubi9-jlinked-image AS ubi9-jlinked-image
76
USER 0
87
RUN mkdir -p /mnt/jrootfs
9-
RUN microdnf install dnf -y
10-
RUN dnf install --installroot /mnt/jrootfs grep gawk --releasever 9 --setopt install_weak_deps=false --nodocs -y;dnf clean all
11-
RUN rm -rf /mnt/jrootfs/var/cache/*
12-
RUN rm -rf /mnt/jrootfs/var/lib/rpm
13-
USER 185
8+
RUN microdnf install dnf -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs
9+
RUN dnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=false --nodocs -y \
10+
grep gawk \
11+
&& dnf clean all
12+
RUN rm -rf /mnt/jrootfs/var/cache/* /mnt/jrootfs/var/lib/rpm
1413

1514
#Stage-2:copy application JAR and jlinked JRE to runtime image
1615
FROM registry.access.redhat.com/ubi9/ubi-micro AS lean-runtime
16+
ARG JAVA_HOME=/usr/lib/jvm/java
1717

1818
COPY --from=ubi9-jlinked-image /mnt/jrootfs/ /
1919
COPY --from=ubi9-jlinked-image /deployments /deployments
20-
COPY --from=ubi9-jlinked-image /tmp/jre /usr/lib/jvm/java
20+
COPY --from=ubi9-jlinked-image /tmp/jre ${JAVA_HOME}
2121
COPY --from=ubi9-jlinked-image /opt/jboss/container/ /opt/jboss/container/
22-
RUN ls -la /opt/jboss/container/*
23-
24-
ENV JAVA_HOME="/usr/lib/jvm/java"
25-
RUN echo $JAVA_HOME
26-
27-
ENV PATH="$JAVA_HOME/bin/:$PATH"
28-
RUN echo $PATH
2922

23+
ENV JAVA_HOME="${JAVA_HOME}" PATH="${JAVA_HOME}/bin:$PATH"
3024
CMD /opt/jboss/container/java/run/run-java.sh
31-

0 commit comments

Comments
 (0)