dockerfile.lint.cloudbuild.yaml (12 lines of code) (raw):
steps:
- id: "Lint Dockerfile"
name: "hadolint/hadolint:latest-alpine" # https://hub.docker.com/r/hadolint/hadolint
entrypoint: "/bin/sh"
args:
- -c
- | # Recursively find dockerfiles (not in testing dir)
find . -name "*Dockerfile" -not -path "./testing/*" \
-exec hadolint {} \; \
| tee /proc/1/fd/1 \
| grep -q "Dockerfile"
if [[ $? -eq 0 ]] ; then exit 1 ; fi