Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related but I found that build record should not be exported for this kind of target:

image

It tries to export the build record because buildx.build.ref is set in the metadata file: https://github.com/moby/buildkit/actions/runs/10366089572/job/28694600862#step:5:268

   {
    "validate-dockerfile-5a93df9b3286bc4794aa2096155c26b8": {
      "buildx.build.ref": "builder-acfc342a-63d0-4501-8680-844fa82ca061/builder-acfc342a-63d0-4501-8680-844fa82ca0610/5jqkz6fanf8rsqd1mqgjq5off",
      "result.json": "{\n  \"warnings\": null,\n  \"sources\": [\n    {\n      \"filename\": \"shfmt.Dockerfile\",\n      \"data\": \"IyBzeW50YXg9ZG9ja2VyL2RvY2tlcmZpbGUtdXBzdHJlYW06bWFzdGVyCgpGUk9NIG12ZGFuL3NoZm10OnYzLjEuMi1hbHBpbmUgQVMgc2hmbXQKV09SS0RJUiAvc3JjCkFSRyBTSEZNVF9GTEFHUz0iLWkgMiAtY2kiCgpGUk9NIHNoZm10IEFTIGdlbmVyYXRlCldPUktESVIgL291dC9oYWNrClJVTiAtLW1vdW50PXRhcmdldD0vc3JjIFwKICBjcCAtYSAvc3JjL2hhY2svLiAuLyAmJiBcCiAgc2hmbXQgLWwgLXcgJFNIRk1UX0ZMQUdTIC4KCkZST00gc2NyYXRjaCBBUyB1cGRhdGUKQ09QWSAtLWZyb209Z2VuZXJhdGUgL291dCAvCgpGUk9NIHNoZm10IEFTIHZhbGlkYXRlClJVTiAtLW1vdW50PXRhcmdldD0uIFwKICBzaGZtdCAkU0hGTVRfRkxBR1MgLWQgLi9oYWNrCg==\",\n      \"definition\": {\n        \"def\": [\n          \"GsQBChJsb2NhbDovL2RvY2tlcmZpbGUSFAoMbG9jYWwuZGlmZmVyEgRub25lEkkKEWxvY2FsLmZvbGxvd3BhdGhzEjRbInNoZm10LkRvY2tlcmZpbGUiLCJzaGZtdC5Eb2NrZXJmaWxlLmRvY2tlcmlnbm9yZSJdEioKDWxvY2FsLnNlc3Npb24SGXZpc2dpbzVucG4wN3EzZXpwZDF0MWJ3NHQSIQoTbG9jYWwuc2hhcmVka2V5aGludBIKZG9ja2VyZmlsZVoA\",\n          \"CkkKR3NoYTI1NjpmOTgyMTAzMjk5MzVkZDQwMWE0NGVhMDQ5MDU3MjRlYWNhMjcyMmM1NWU5N2ViNTFhNGE5NWNkMjBmZjEwYWM2\"\n        ],\n        \"metadata\": {\n          \"sha256:3f97713c82a92b5d9c8289e6d3aaf8cd7c37b6bca4600043f313430130e1e3b7\": {\n            \"caps\": {\n              \"constraints\": true,\n              \"meta.description\": true,\n              \"platform\": true\n            }\n          },\n          \"sha256:f98210329935dd401a44ea04905724eaca2722c55e97eb51a4a95cd20ff10ac6\": {\n            \"description\": {\n              \"llb.customname\": \"[internal] load build definition from shfmt.Dockerfile\"\n            },\n            \"caps\": {\n              \"source.local\": true,\n              \"source.local.followpaths\": true,\n              \"source.local.sessionid\": true,\n              \"source.local.sharedkeyhint\": true\n            }\n          }\n        },\n        \"Source\": {\n          \"locations\": {\n            \"sha256:f98210329935dd401a44ea04905724eaca2722c55e97eb51a4a95cd20ff10ac6\": {}\n          }\n        }\n      },\n      \"language\": \"Dockerfile\"\n    }\n  ]\n}",
      "result.statuscode": "0",
      "result.txt": "",
      "version": "1.0.0"
    }
  }

I think we should omit setting it for subrequests. Will open a PR on Buildx to fix that.

}

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
Comment on lines +41 to +43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't catch this was not a multiplatform image, we should be able to build the tool in this Dockerfile instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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