ci,makefile: add hadolint Dockerfile linting
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2021-05-07 02:31:53 +02:00
parent 06da368535
commit 31220d9c1b
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
3 changed files with 32 additions and 2 deletions

@ -8,6 +8,21 @@ platform:
arch: amd64
steps:
- name: hadolint
pull: always
image: hadolint/hadolint:v1.23.0-8-gb01c5a9-alpine
commands:
- hadolint --version
- hadolint Dockerfile
when:
ref:
- refs/heads/dev
- "refs/heads/feature-**"
- "refs/pull/**"
- "refs/tags/**"
event:
exclude: [cron]
- name: kaniko-build
pull: always
image: immawanderer/drone-kaniko:linux-amd64

10
.hadolint.yaml Normal file

@ -0,0 +1,10 @@
ignored:
# DL3039 error: Do not use dnf update.
# image is nightly updated
- DL3039
# DL3041 warning: Specify version with `dnf install -y <package>-<version>`.
- DL3041
# SC2039 warning: In POSIX sh, brace expansion is undefined.
# it actually still works
- SC2039

@ -9,8 +9,13 @@ kanikoexecutorimg = gcr.io/kaniko-project/executor:debug
kanikowdir = /src
kanikocontext = .
kanikoargs = -f=$(dfile) -c=$(kanikocontext) --use-new-run --snapshotMode=redo --no-push --force
hadolintimg = hadolint/hadolint:v1.23.0-8-gb01c5a9-alpine
hadolintargs = run --rm -i -v $$PWD/.hadolint.yaml:/root/.config/hadolint.yaml
.PHONY: build kaniko clean test prune
.PHONY: hadolint build kaniko clean test prune
hadolint:
$(dcmd) $(hadolintargs) $(hadolintimg) < $(dfile)
kaniko:
$(dcmd) $(dargskaniko) $(kanikoexecutorimg) $(kanikoargs)
@ -21,7 +26,7 @@ build:
clean:
$(dcmd) $(cleanargs)
test: build kaniko
test: hadolint build kaniko
prune:
$(dcmd) $(pruneargs)