Last active
November 6, 2024 19:06
-
-
Save turing85/7c450dd048fcf2ed94fed8ad5cdc5d9f to your computer and use it in GitHub Desktop.
Multistage dockerfile to install software into an UBI micro image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG MICRODIR=/microdir | |
ARG PACKAGES_TO_INSTALL="java-17-openjdk-devel" | |
FROM registry.access.redhat.com/ubi8-micro@sha256:eb4245271537034f69ee336a4a2b31d3fbae4048ec1db53ff89de749c35cf537 AS BASE | |
FROM registry.access.redhat.com/ubi8@sha256:83c0e63f5efb64cba26be647e93bf036b8d88b774f0726936c1b956424b1abf6 AS BUILD | |
ARG MICRODIR | |
ARG PACKAGES_TO_INSTALL | |
RUN mkdir ${MICRODIR} | |
COPY --from=BASE / ${MICRODIR} | |
RUN yum install \ | |
--installroot ${MICRODIR} \ | |
--releasever 8 \ | |
--setop install_weak_deps=false \ | |
-y \ | |
${PACKAGES_TO_INSTALL} | |
RUN yum clean all \ | |
--installroot ${MICRODIR} | |
FROM scratch AS IMAGE | |
ARG MICRODIR | |
COPY --from=BUILD ${MICRODIR}/ . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment