From c6caed1a388f6096ece06a6e1553728e1e685904 Mon Sep 17 00:00:00 2001 From: Niko Wenselowski Date: Thu, 5 Dec 2024 17:01:21 +0100 Subject: [PATCH] Dockerfile: Move ARG statements 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 --- docker_image/Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker_image/Dockerfile b/docker_image/Dockerfile index db1b6606adf..541baafd3a5 100644 --- a/docker_image/Dockerfile +++ b/docker_image/Dockerfile @@ -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 @@ -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 /