From 754a2258181ac44746bec369679bbed51e95c0fd Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Fri, 30 Aug 2024 13:07:00 -0400 Subject: [PATCH] Convert non-distributable install to ONBUILD This way downstream consumers do not need to fork or otherwise build the ironlib image to add the non-distributable binaries. Take vogelkop as an example, OSS Dockerfile can depend on this image just fine. Downstream users can then do something like: ```Dockerfile FROM $vogelkopimage AS vogelkop FROM $ironlibimage COPY --from=vogelkop /usr/bin/vogelkop /usr/bin ``` And then provide the values for ONBUILD on the docker command line to fetch the non-distributable files. No need to fork ironlib nor vogelkop's Dockerfiles! --- Dockerfile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5489f2b7..67925280 100644 --- a/Dockerfile +++ b/Dockerfile @@ -86,18 +86,17 @@ RUN if [[ $TARGETARCH == "amd64" ]] ; then \ # Delete /tmp/* as we don't need those included in the image. RUN rm -rf /tmp/* -# The non-distributable files are executables provided by hardware vendors. -ARG AWS_ACCESS_KEY_ID -ARG AWS_SECRET_ACCESS_KEY -ARG BUCKET -ARG INSTALL_NON_DISTRIBUTABLE -COPY scripts/install-non-distributable.sh non-distributable/ -RUN cd non-distributable && ./install-non-distributable.sh -RUN rm -rf non-distributable/ - # Use same base image used by deps so that we keep all the meta-vars (CMD, PATH, ...) FROM base # copy ironlib wrapper binaries COPY --from=helper-binaries /usr/sbin/getbiosconfig /usr/sbin/getinventory /usr/sbin/ # copy installed packages COPY --from=deps / / + +# Install non-distributable files when the env var is set, left for downstream consumers +COPY scripts/install-non-distributable.sh non-distributable/ +ONBUILD ARG AWS_ACCESS_KEY_ID +ONBUILD ARG AWS_SECRET_ACCESS_KEY +ONBUILD ARG BUCKET +ONBUILD ARG INSTALL_NON_DISTRIBUTABLE +ONBUILD RUN cd non-distributable && ./install-non-distributable.sh