From f6092289dd9957c29d45851d6c15c69e24998b5c Mon Sep 17 00:00:00 2001 From: sebthom Date: Mon, 1 May 2023 13:28:58 +0200 Subject: [PATCH] add Dockerfile linter --- .github/workflows/build.yml | 7 ++++++- image/DinD.Dockerfile | 31 ++++++++++++++----------------- image/Dockerfile | 21 +++++++++------------ 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8beaa8e..fd35546 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,9 +49,14 @@ jobs: - name: Git Checkout uses: actions/checkout@v3 #https://github.com/actions/checkout + - name: Check Dockerfile + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: image/${{ matrix.DOCKER_FILE }} + ignore: DL3008,SC1091 # https://github.com/hadolint/hadolint/wiki/DL3008 + - name: Cache trivy cache uses: actions/cache@v3 - if: env.ACT != 'true' # https://github.com/nektos/act#skipping-steps with: path: ${{ env.TRIVY_CACHE_DIR }} # https://github.com/actions/cache/issues/342#issuecomment-673371329 diff --git a/image/DinD.Dockerfile b/image/DinD.Dockerfile index c9ed0bb..ad251d7 100644 --- a/image/DinD.Dockerfile +++ b/image/DinD.Dockerfile @@ -15,7 +15,7 @@ LABEL maintainer="Vegard IT GmbH (vegardit.com)" USER root -SHELL ["/bin/bash", "-c"] +SHELL ["/bin/bash", "-euo", "pipefail", "-c"] ARG DEBIAN_FRONTEND=noninteractive ARG LC_ALL=C @@ -29,18 +29,17 @@ ARG BASE_LAYER_CACHE_KEY RUN --mount=type=bind,source=.shared,target=/mnt/shared < /etc/apt/sources.list.d/docker.list + "$(source /etc/os-release && echo "$VERSION_CODENAME")" stable" > /etc/apt/sources.list.d/docker.list apt-get update apt-get install --no-install-recommends -y docker-ce docker-ce-cli containerd.io fuse-overlayfs @@ -103,10 +102,10 @@ RUN --mount=type=bind,source=.shared,target=/mnt/shared <