Skip to content

Commit

Permalink
Convert non-distributable install to ONBUILD
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
mmlb committed Sep 3, 2024
1 parent a7c1444 commit f909b99
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,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

0 comments on commit f909b99

Please sign in to comment.