From 686474f81505b0b7aae323669809dd86f6186427 Mon Sep 17 00:00:00 2001 From: Jeremy Lin Date: Sun, 22 Jan 2023 01:21:52 -0800 Subject: [PATCH] Disable Hadolint check for consecutive `RUN` instructions (DL3059) This check doesn't seem to add enough value to justify the difficulties it tends to create when generating `RUN` instructions from a template. --- .hadolint.yaml | 2 ++ docker/Dockerfile.j2 | 5 ----- docker/amd64/Dockerfile | 1 - docker/amd64/Dockerfile.alpine | 1 - docker/amd64/Dockerfile.buildkit | 1 - docker/amd64/Dockerfile.buildkit.alpine | 1 - docker/arm64/Dockerfile | 4 ---- docker/arm64/Dockerfile.alpine | 3 --- docker/arm64/Dockerfile.buildkit | 4 ---- docker/arm64/Dockerfile.buildkit.alpine | 3 --- docker/armv6/Dockerfile | 5 ----- docker/armv6/Dockerfile.alpine | 3 --- docker/armv6/Dockerfile.buildkit | 5 ----- docker/armv6/Dockerfile.buildkit.alpine | 3 --- docker/armv7/Dockerfile | 4 ---- docker/armv7/Dockerfile.alpine | 3 --- docker/armv7/Dockerfile.buildkit | 4 ---- docker/armv7/Dockerfile.buildkit.alpine | 3 --- 18 files changed, 2 insertions(+), 53 deletions(-) diff --git a/.hadolint.yaml b/.hadolint.yaml index f1c324b8..1c305f9d 100644 --- a/.hadolint.yaml +++ b/.hadolint.yaml @@ -3,5 +3,7 @@ ignored: - DL3008 # disable explicit version for apk install - DL3018 + # disable check for consecutive `RUN` instructions + - DL3059 trustedRegistries: - docker.io diff --git a/docker/Dockerfile.j2 b/docker/Dockerfile.j2 index 095c295a..8c5157f4 100644 --- a/docker/Dockerfile.j2 +++ b/docker/Dockerfile.j2 @@ -106,7 +106,6 @@ ENV RUSTFLAGS='-Clink-arg=/usr/local/musl/{{ package_arch_target }}/lib/libatomi {% elif "arm" in target_file %} # # Install required build libs for {{ package_arch_name }} architecture. -# hadolint ignore=DL3059 RUN dpkg --add-architecture {{ package_arch_name }} \ && apt-get update \ && apt-get install -y \ @@ -178,7 +177,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN {{ mount_rust_cache -}} cargo build --features ${DB} --release{{ package_arch_target_param }} ######################## RUNTIME IMAGE ######################## @@ -195,7 +193,6 @@ ENV ROCKET_PROFILE="release" \ {% if "amd64" not in target_file %} -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] {% endif %} @@ -222,13 +219,11 @@ RUN mkdir /data \ {% if "armv6" in target_file and "alpine" not in target_file %} # In the Balena Bullseye images for armv6/rpi-debian there is a missing symlink. # This symlink was there in the buster images, and for some reason this is needed. -# hadolint ignore=DL3059 RUN ln -v -s /lib/ld-linux-armhf.so.3 /lib/ld-linux.so.3 {% endif -%} {% if "amd64" not in target_file %} -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] {% endif %} diff --git a/docker/amd64/Dockerfile b/docker/amd64/Dockerfile index 09b959dd..281146f7 100644 --- a/docker/amd64/Dockerfile +++ b/docker/amd64/Dockerfile @@ -81,7 +81,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN cargo build --features ${DB} --release ######################## RUNTIME IMAGE ######################## diff --git a/docker/amd64/Dockerfile.alpine b/docker/amd64/Dockerfile.alpine index eba7a10f..6dd624b6 100644 --- a/docker/amd64/Dockerfile.alpine +++ b/docker/amd64/Dockerfile.alpine @@ -75,7 +75,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN cargo build --features ${DB} --release --target=x86_64-unknown-linux-musl ######################## RUNTIME IMAGE ######################## diff --git a/docker/amd64/Dockerfile.buildkit b/docker/amd64/Dockerfile.buildkit index ae841026..12e85211 100644 --- a/docker/amd64/Dockerfile.buildkit +++ b/docker/amd64/Dockerfile.buildkit @@ -81,7 +81,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry cargo build --features ${DB} --release ######################## RUNTIME IMAGE ######################## diff --git a/docker/amd64/Dockerfile.buildkit.alpine b/docker/amd64/Dockerfile.buildkit.alpine index e1a1de9b..ba45c39b 100644 --- a/docker/amd64/Dockerfile.buildkit.alpine +++ b/docker/amd64/Dockerfile.buildkit.alpine @@ -75,7 +75,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry cargo build --features ${DB} --release --target=x86_64-unknown-linux-musl ######################## RUNTIME IMAGE ######################## diff --git a/docker/arm64/Dockerfile b/docker/arm64/Dockerfile index eabadb47..093afadd 100644 --- a/docker/arm64/Dockerfile +++ b/docker/arm64/Dockerfile @@ -46,7 +46,6 @@ RUN mkdir -pv "${CARGO_HOME}" \ # # Install required build libs for arm64 architecture. -# hadolint ignore=DL3059 RUN dpkg --add-architecture arm64 \ && apt-get update \ && apt-get install -y \ @@ -101,7 +100,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN cargo build --features ${DB} --release --target=aarch64-unknown-linux-gnu ######################## RUNTIME IMAGE ######################## @@ -113,7 +111,6 @@ ENV ROCKET_PROFILE="release" \ ROCKET_ADDRESS=0.0.0.0 \ ROCKET_PORT=80 -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -128,7 +125,6 @@ RUN mkdir /data \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/arm64/Dockerfile.alpine b/docker/arm64/Dockerfile.alpine index f880d8ec..83bf0745 100644 --- a/docker/arm64/Dockerfile.alpine +++ b/docker/arm64/Dockerfile.alpine @@ -75,7 +75,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN cargo build --features ${DB} --release --target=aarch64-unknown-linux-musl ######################## RUNTIME IMAGE ######################## @@ -89,7 +88,6 @@ ENV ROCKET_PROFILE="release" \ SSL_CERT_DIR=/etc/ssl/certs -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -100,7 +98,6 @@ RUN mkdir /data \ curl \ ca-certificates -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/arm64/Dockerfile.buildkit b/docker/arm64/Dockerfile.buildkit index dc5620e4..cdabd35c 100644 --- a/docker/arm64/Dockerfile.buildkit +++ b/docker/arm64/Dockerfile.buildkit @@ -46,7 +46,6 @@ RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/. # # Install required build libs for arm64 architecture. -# hadolint ignore=DL3059 RUN dpkg --add-architecture arm64 \ && apt-get update \ && apt-get install -y \ @@ -101,7 +100,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry cargo build --features ${DB} --release --target=aarch64-unknown-linux-gnu ######################## RUNTIME IMAGE ######################## @@ -113,7 +111,6 @@ ENV ROCKET_PROFILE="release" \ ROCKET_ADDRESS=0.0.0.0 \ ROCKET_PORT=80 -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -128,7 +125,6 @@ RUN mkdir /data \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/arm64/Dockerfile.buildkit.alpine b/docker/arm64/Dockerfile.buildkit.alpine index b8fc36c1..837a7a39 100644 --- a/docker/arm64/Dockerfile.buildkit.alpine +++ b/docker/arm64/Dockerfile.buildkit.alpine @@ -75,7 +75,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry cargo build --features ${DB} --release --target=aarch64-unknown-linux-musl ######################## RUNTIME IMAGE ######################## @@ -89,7 +88,6 @@ ENV ROCKET_PROFILE="release" \ SSL_CERT_DIR=/etc/ssl/certs -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -100,7 +98,6 @@ RUN mkdir /data \ curl \ ca-certificates -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/armv6/Dockerfile b/docker/armv6/Dockerfile index 7ddbdee8..84baa7b6 100644 --- a/docker/armv6/Dockerfile +++ b/docker/armv6/Dockerfile @@ -46,7 +46,6 @@ RUN mkdir -pv "${CARGO_HOME}" \ # # Install required build libs for armel architecture. -# hadolint ignore=DL3059 RUN dpkg --add-architecture armel \ && apt-get update \ && apt-get install -y \ @@ -101,7 +100,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN cargo build --features ${DB} --release --target=arm-unknown-linux-gnueabi ######################## RUNTIME IMAGE ######################## @@ -113,7 +111,6 @@ ENV ROCKET_PROFILE="release" \ ROCKET_ADDRESS=0.0.0.0 \ ROCKET_PORT=80 -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -130,10 +127,8 @@ RUN mkdir /data \ # In the Balena Bullseye images for armv6/rpi-debian there is a missing symlink. # This symlink was there in the buster images, and for some reason this is needed. -# hadolint ignore=DL3059 RUN ln -v -s /lib/ld-linux-armhf.so.3 /lib/ld-linux.so.3 -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/armv6/Dockerfile.alpine b/docker/armv6/Dockerfile.alpine index 65bb552b..1f969d7c 100644 --- a/docker/armv6/Dockerfile.alpine +++ b/docker/armv6/Dockerfile.alpine @@ -77,7 +77,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN cargo build --features ${DB} --release --target=arm-unknown-linux-musleabi ######################## RUNTIME IMAGE ######################## @@ -91,7 +90,6 @@ ENV ROCKET_PROFILE="release" \ SSL_CERT_DIR=/etc/ssl/certs -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -102,7 +100,6 @@ RUN mkdir /data \ curl \ ca-certificates -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/armv6/Dockerfile.buildkit b/docker/armv6/Dockerfile.buildkit index 7b9aab8a..1e33a25f 100644 --- a/docker/armv6/Dockerfile.buildkit +++ b/docker/armv6/Dockerfile.buildkit @@ -46,7 +46,6 @@ RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/. # # Install required build libs for armel architecture. -# hadolint ignore=DL3059 RUN dpkg --add-architecture armel \ && apt-get update \ && apt-get install -y \ @@ -101,7 +100,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry cargo build --features ${DB} --release --target=arm-unknown-linux-gnueabi ######################## RUNTIME IMAGE ######################## @@ -113,7 +111,6 @@ ENV ROCKET_PROFILE="release" \ ROCKET_ADDRESS=0.0.0.0 \ ROCKET_PORT=80 -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -130,10 +127,8 @@ RUN mkdir /data \ # In the Balena Bullseye images for armv6/rpi-debian there is a missing symlink. # This symlink was there in the buster images, and for some reason this is needed. -# hadolint ignore=DL3059 RUN ln -v -s /lib/ld-linux-armhf.so.3 /lib/ld-linux.so.3 -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/armv6/Dockerfile.buildkit.alpine b/docker/armv6/Dockerfile.buildkit.alpine index 4bced53d..d0f5cfbe 100644 --- a/docker/armv6/Dockerfile.buildkit.alpine +++ b/docker/armv6/Dockerfile.buildkit.alpine @@ -77,7 +77,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry cargo build --features ${DB} --release --target=arm-unknown-linux-musleabi ######################## RUNTIME IMAGE ######################## @@ -91,7 +90,6 @@ ENV ROCKET_PROFILE="release" \ SSL_CERT_DIR=/etc/ssl/certs -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -102,7 +100,6 @@ RUN mkdir /data \ curl \ ca-certificates -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/armv7/Dockerfile b/docker/armv7/Dockerfile index bcbf946c..8df12612 100644 --- a/docker/armv7/Dockerfile +++ b/docker/armv7/Dockerfile @@ -46,7 +46,6 @@ RUN mkdir -pv "${CARGO_HOME}" \ # # Install required build libs for armhf architecture. -# hadolint ignore=DL3059 RUN dpkg --add-architecture armhf \ && apt-get update \ && apt-get install -y \ @@ -101,7 +100,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN cargo build --features ${DB} --release --target=armv7-unknown-linux-gnueabihf ######################## RUNTIME IMAGE ######################## @@ -113,7 +111,6 @@ ENV ROCKET_PROFILE="release" \ ROCKET_ADDRESS=0.0.0.0 \ ROCKET_PORT=80 -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -128,7 +125,6 @@ RUN mkdir /data \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/armv7/Dockerfile.alpine b/docker/armv7/Dockerfile.alpine index 6d14ae34..1872e54e 100644 --- a/docker/armv7/Dockerfile.alpine +++ b/docker/armv7/Dockerfile.alpine @@ -75,7 +75,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN cargo build --features ${DB} --release --target=armv7-unknown-linux-musleabihf ######################## RUNTIME IMAGE ######################## @@ -89,7 +88,6 @@ ENV ROCKET_PROFILE="release" \ SSL_CERT_DIR=/etc/ssl/certs -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -100,7 +98,6 @@ RUN mkdir /data \ curl \ ca-certificates -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/armv7/Dockerfile.buildkit b/docker/armv7/Dockerfile.buildkit index 0084526b..4ff8364a 100644 --- a/docker/armv7/Dockerfile.buildkit +++ b/docker/armv7/Dockerfile.buildkit @@ -46,7 +46,6 @@ RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/. # # Install required build libs for armhf architecture. -# hadolint ignore=DL3059 RUN dpkg --add-architecture armhf \ && apt-get update \ && apt-get install -y \ @@ -101,7 +100,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry cargo build --features ${DB} --release --target=armv7-unknown-linux-gnueabihf ######################## RUNTIME IMAGE ######################## @@ -113,7 +111,6 @@ ENV ROCKET_PROFILE="release" \ ROCKET_ADDRESS=0.0.0.0 \ ROCKET_PORT=80 -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -128,7 +125,6 @@ RUN mkdir /data \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data diff --git a/docker/armv7/Dockerfile.buildkit.alpine b/docker/armv7/Dockerfile.buildkit.alpine index d29465bb..2fc23849 100644 --- a/docker/armv7/Dockerfile.buildkit.alpine +++ b/docker/armv7/Dockerfile.buildkit.alpine @@ -75,7 +75,6 @@ RUN touch src/main.rs # Builds again, this time it'll just be # your actual source files being built -# hadolint ignore=DL3059 RUN --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/root/.cargo/registry cargo build --features ${DB} --release --target=armv7-unknown-linux-musleabihf ######################## RUNTIME IMAGE ######################## @@ -89,7 +88,6 @@ ENV ROCKET_PROFILE="release" \ SSL_CERT_DIR=/etc/ssl/certs -# hadolint ignore=DL3059 RUN [ "cross-build-start" ] # Create data folder and Install needed libraries @@ -100,7 +98,6 @@ RUN mkdir /data \ curl \ ca-certificates -# hadolint ignore=DL3059 RUN [ "cross-build-end" ] VOLUME /data