Skip to content

Commit

Permalink
Dockerfile: Move ARG statements
Browse files Browse the repository at this point in the history
Changing the values of an ARG statement will invalidate all following
RUN statements, because the ARGs are passed as environment variables to
the RUN statements.
We move them to where they are actually needed to benefit from unchanged
layers as much as possible.

Change-Id: Ia56e6b1a5a9a75967003dc1ccb43e6d5cc032fc9
  • Loading branch information
okin committed Jan 14, 2025
1 parent eae20c1 commit c6caed1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docker_image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ COPY docker-entrypoint.sh /
# Starts the entrypoint script and hands over CMD by default
ENTRYPOINT ["/docker-entrypoint.sh"]

# Pure build time variable declarations (docker build --build-arg KEY=val)
ARG CMK_VERSION="2.5.0b1"
ARG CMK_EDITION
# Distro codename is used to find the corresponding .deb package
ARG DISTRO_CODENAME="jammy"

# Make the list of required packages available to the following command
COPY needed-packages /needed-packages

Expand Down Expand Up @@ -76,6 +70,12 @@ RUN set -e \
&& rm -rf /var/lib/apt/lists/* \
&& rm needed-packages

# Pure build time variable declarations (docker build --build-arg KEY=val)
ARG CMK_VERSION="2.5.0b1"
ARG CMK_EDITION
# Distro codename is used to find the corresponding .deb package
ARG DISTRO_CODENAME="jammy"

# Optionally copy an existing Checkmk debian package to the container. In case the file is
# available that is later used by the build procedure the file will not be downloaded.
COPY check-mk-${CMK_EDITION}-${CMK_VERSION}_0.${DISTRO_CODENAME}*.deb Check_MK-pubkey.gpg /
Expand Down

0 comments on commit c6caed1

Please sign in to comment.