Skip to content

Commit

Permalink
Merge pull request #5248 from tonistiigi/dockerfile-validate
Browse files Browse the repository at this point in the history
ci: enable validating all Dockerfiles
  • Loading branch information
crazy-max authored Aug 13, 2024
2 parents 8a58645 + b8f3379 commit 836fe2b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ exec dlv exec /usr/bin/buildkitd \\
--continue \\
-- "\$@"
EOF
ENV DELVE_PORT 5000
ENV DELVE_PORT=5000
ENTRYPOINT ["/docker-entrypoint.sh"]

FROM binaries AS buildkit-darwin
Expand Down
24 changes: 23 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ target "integration-tests" {
}

group "validate" {
targets = ["lint", "validate-vendor", "validate-doctoc", "validate-generated-files", "validate-archutil", "validate-shfmt", "validate-docs", "validate-docs-dockerfile"]
targets = ["lint", "validate-vendor", "validate-doctoc", "validate-dockerfile", "validate-generated-files", "validate-archutil", "validate-shfmt", "validate-docs", "validate-docs-dockerfile"]
}

target "lint" {
Expand Down Expand Up @@ -218,6 +218,28 @@ target "validate-docs-dockerfile" {
output = ["type=cacheonly"]
}

target "validate-dockerfile" {
matrix = {
dockerfile = [
"Dockerfile",
"./hack/dockerfiles/archutil.Dockerfile",
"./hack/dockerfiles/authors.Dockerfile",
"./hack/dockerfiles/docs-dockerfile.Dockerfile",
"./hack/dockerfiles/docs.Dockerfile",
"./hack/dockerfiles/doctoc.Dockerfile",
"./hack/dockerfiles/generated-files.Dockerfile",
"./hack/dockerfiles/govulncheck.Dockerfile",
"./hack/dockerfiles/lint.Dockerfile",
"./hack/dockerfiles/shfmt.Dockerfile",
"./hack/dockerfiles/vendor.Dockerfile",
"./frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile",
]
}
name = "validate-dockerfile-${md5(dockerfile)}"
dockerfile = dockerfile
call = "check"
}

target "vendor" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
Expand Down
4 changes: 3 additions & 1 deletion hack/dockerfiles/vendor.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ RUN --mount=target=/context \
fi
EOT

FROM psampaz/go-mod-outdated:${MODOUTDATED_VERSION} AS go-mod-outdated
FROM --platform=linux/amd64 psampaz/go-mod-outdated:${MODOUTDATED_VERSION} AS go-mod-outdated-amd64

FROM go-mod-outdated-amd64 AS go-mod-outdated
FROM base AS outdated
RUN --mount=target=.,rw \
--mount=target=/go/pkg/mod,type=cache \
Expand Down

0 comments on commit 836fe2b

Please sign in to comment.