|
1 | 1 | #multi-stage build for jlinked application JAR and JRE
|
2 | 2 |
|
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 |
6 | 5 | FROM ubi9-jlinked-image AS ubi9-jlinked-image
|
7 | 6 | USER 0
|
8 | 7 | 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 --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y \ |
| 9 | + --config=/etc/dnf/dnf.conf \ |
| 10 | + --noplugins \ |
| 11 | + --setopt=cachedir=/var/cache \ |
| 12 | + --setopt=reposdir=/etc/yum.repos.d \ |
| 13 | + --setopt=varsdir=/etc/dnf/vars \ |
| 14 | + grep gawk |
| 15 | +RUN rm -rf /mnt/jrootfs/var/cache/* /mnt/jrootfs/var/lib/rpm /mnt/jrootfs/var/lib/dnf |
14 | 16 |
|
15 | 17 | #Stage-2:copy application JAR and jlinked JRE to runtime image
|
16 | 18 | FROM registry.access.redhat.com/ubi9/ubi-micro AS lean-runtime
|
| 19 | +ARG JAVA_HOME=/usr/lib/jvm/java |
17 | 20 |
|
18 | 21 | COPY --from=ubi9-jlinked-image /mnt/jrootfs/ /
|
19 | 22 | COPY --from=ubi9-jlinked-image /deployments /deployments
|
20 |
| -COPY --from=ubi9-jlinked-image /tmp/jre /usr/lib/jvm/java |
| 23 | +COPY --from=ubi9-jlinked-image /tmp/jre ${JAVA_HOME} |
21 | 24 | 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 |
| 25 | +# these are in the micro image |
| 26 | +RUN rm -rf /var/lib/dnf /var/lib/rpm |
29 | 27 |
|
| 28 | +ENV JAVA_HOME="${JAVA_HOME}" PATH="${JAVA_HOME}/bin:$PATH" |
| 29 | +USER 185 |
30 | 30 | CMD /opt/jboss/container/java/run/run-java.sh
|
31 |
| - |
0 commit comments