-
Notifications
You must be signed in to change notification settings - Fork 1.3k
hack: use bake to build buildkit images #6107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
.github/workflows/buildkit.yml
Outdated
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.IMAGE_NAME }} | ||
# versioning strategy | ||
## push semver tag v0.24.0 | ||
### moby/buildkit:v0.24.0 | ||
### moby/buildkit:latest | ||
### moby/buildkit:v0.24.0-rootless | ||
### moby/buildkit:rootless | ||
## push semver prerelease tag v0.24.0-rc1 | ||
### moby/buildkit:v0.24.0-rc1 | ||
### moby/buildkit:v0.24.0-rc1-rootless | ||
## push on master | ||
### moby/buildkit:master | ||
## scheduled event on master | ||
### moby/buildkit:nightly | ||
tags: | | ||
type=schedule,pattern=nightly,suffix=${{ env.TAG_SUFFIX }} | ||
type=ref,event=branch,suffix=${{ env.TAG_SUFFIX }} | ||
type=ref,event=pr,suffix=${{ env.TAG_SUFFIX }} | ||
type=semver,pattern={{raw}},suffix=${{ env.TAG_SUFFIX }} | ||
type=raw,value=${{ env.TAG_LATEST }} | ||
flavor: | | ||
latest=false | ||
annotations: | | ||
org.opencontainers.image.title=BuildKit | ||
org.opencontainers.image.vendor=Moby | ||
bake-target: meta-helper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested multiple events on my fork:
push on master
image
https://github.com/crazy-max/buildkit/actions/runs/16961888702/job/48076575201#step:6:1
{
"group": {
"default": {
"targets": [
"image-cross"
]
}
},
"target": {
"image-cross": {
"annotations": [
"manifest:org.opencontainers.image.created=2025-08-14T09:56:07.905Z",
"manifest:org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit",
"manifest:org.opencontainers.image.licenses=Apache-2.0",
"manifest:org.opencontainers.image.revision=64dca37637af3bc5106d8c860bc4355311818317",
"manifest:org.opencontainers.image.source=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.title=BuildKit",
"manifest:org.opencontainers.image.url=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.vendor=Moby",
"manifest:org.opencontainers.image.version=master"
],
"attest": [
{
"type": "sbom"
},
{
"builder-id": "https://github.com/crazy-max/buildkit/actions/runs/16961888702/attempts/1",
"mode": "max",
"type": "provenance"
}
],
"context": ".",
"dockerfile": "Dockerfile",
"args": {
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
"DOCKER_META_IMAGES": "moby/buildkit",
"DOCKER_META_VERSION": "master",
"GO_VERSION": "1.24"
},
"tags": [
"moby/buildkit:master"
],
"cache-from": [
{
"scope": "image",
"type": "gha"
}
],
"cache-to": [
{
"scope": "image",
"type": "gha"
}
],
"target": "",
"platforms": [
"linux/amd64",
"linux/arm/v7",
"linux/arm64",
"linux/s390x",
"linux/ppc64le",
"linux/riscv64"
],
"output": [
{
"type": "image"
}
]
}
}
}
image (rootless)
https://github.com/crazy-max/buildkit/actions/runs/16961888702/job/48076575207#step:6:1
{
"group": {
"default": {
"targets": [
"image-cross"
]
}
},
"target": {
"image-cross": {
"annotations": [
"manifest:org.opencontainers.image.created=2025-08-14T09:56:03.712Z",
"manifest:org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit",
"manifest:org.opencontainers.image.licenses=Apache-2.0",
"manifest:org.opencontainers.image.revision=64dca37637af3bc5106d8c860bc4355311818317",
"manifest:org.opencontainers.image.source=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.title=BuildKit",
"manifest:org.opencontainers.image.url=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.vendor=Moby",
"manifest:org.opencontainers.image.version=master-rootless"
],
"attest": [
{
"type": "sbom"
},
{
"builder-id": "https://github.com/crazy-max/buildkit/actions/runs/16961888702/attempts/1",
"mode": "max",
"type": "provenance"
}
],
"context": ".",
"dockerfile": "Dockerfile",
"args": {
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
"DOCKER_META_IMAGES": "moby/buildkit",
"DOCKER_META_VERSION": "master-rootless",
"GO_VERSION": "1.24"
},
"tags": [
"moby/buildkit:master-rootless"
],
"cache-from": [
{
"scope": "imagerootless",
"type": "gha"
}
],
"cache-to": [
{
"scope": "imagerootless",
"type": "gha"
}
],
"target": "rootless",
"platforms": [
"linux/amd64",
"linux/arm/v7",
"linux/arm64",
"linux/s390x",
"linux/ppc64le",
"linux/riscv64"
],
"output": [
{
"type": "image"
}
]
}
}
}
push v0.24.0-rc1 tag
image
https://github.com/crazy-max/buildkit/actions/runs/16961918571/job/48076537035#step:6:1
{
"group": {
"default": {
"targets": [
"image-cross"
]
}
},
"target": {
"image-cross": {
"annotations": [
"manifest:org.opencontainers.image.created=2025-08-14T09:55:27.056Z",
"manifest:org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit",
"manifest:org.opencontainers.image.licenses=Apache-2.0",
"manifest:org.opencontainers.image.revision=64dca37637af3bc5106d8c860bc4355311818317",
"manifest:org.opencontainers.image.source=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.title=BuildKit",
"manifest:org.opencontainers.image.url=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.vendor=Moby",
"manifest:org.opencontainers.image.version=v0.24.0-rc1"
],
"attest": [
{
"type": "sbom"
},
{
"builder-id": "https://github.com/crazy-max/buildkit/actions/runs/16961918571/attempts/1",
"mode": "max",
"type": "provenance"
}
],
"context": ".",
"dockerfile": "Dockerfile",
"args": {
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
"DOCKER_META_IMAGES": "moby/buildkit",
"DOCKER_META_VERSION": "v0.24.0-rc1",
"GO_VERSION": "1.24"
},
"tags": [
"moby/buildkit:v0.24.0-rc1"
],
"cache-from": [
{
"scope": "image",
"type": "gha"
}
],
"cache-to": [
{
"scope": "image",
"type": "gha"
}
],
"target": "",
"platforms": [
"linux/amd64",
"linux/arm/v7",
"linux/arm64",
"linux/s390x",
"linux/ppc64le",
"linux/riscv64"
],
"output": [
{
"type": "image"
}
]
}
}
}
image (rootless)
https://github.com/crazy-max/buildkit/actions/runs/16961918571/job/48076537038#step:6:1
{
"group": {
"default": {
"targets": [
"image-cross"
]
}
},
"target": {
"image-cross": {
"annotations": [
"manifest:org.opencontainers.image.created=2025-08-14T09:55:24.827Z",
"manifest:org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit",
"manifest:org.opencontainers.image.licenses=Apache-2.0",
"manifest:org.opencontainers.image.revision=64dca37637af3bc5106d8c860bc4355311818317",
"manifest:org.opencontainers.image.source=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.title=BuildKit",
"manifest:org.opencontainers.image.url=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.vendor=Moby",
"manifest:org.opencontainers.image.version=v0.24.0-rc1-rootless"
],
"attest": [
{
"type": "sbom"
},
{
"builder-id": "https://github.com/crazy-max/buildkit/actions/runs/16961918571/attempts/1",
"mode": "max",
"type": "provenance"
}
],
"context": ".",
"dockerfile": "Dockerfile",
"args": {
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
"DOCKER_META_IMAGES": "moby/buildkit",
"DOCKER_META_VERSION": "v0.24.0-rc1-rootless",
"GO_VERSION": "1.24"
},
"tags": [
"moby/buildkit:v0.24.0-rc1-rootless"
],
"cache-from": [
{
"scope": "imagerootless",
"type": "gha"
}
],
"cache-to": [
{
"scope": "imagerootless",
"type": "gha"
}
],
"target": "rootless",
"platforms": [
"linux/amd64",
"linux/arm/v7",
"linux/arm64",
"linux/s390x",
"linux/ppc64le",
"linux/riscv64"
],
"output": [
{
"type": "image"
}
]
}
}
}
push v0.24.0 tag
image
https://github.com/crazy-max/buildkit/actions/runs/16961922112/job/48076548628#step:6:1
{
"group": {
"default": {
"targets": [
"image-cross"
]
}
},
"target": {
"image-cross": {
"annotations": [
"manifest:org.opencontainers.image.created=2025-08-14T09:55:35.224Z",
"manifest:org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit",
"manifest:org.opencontainers.image.licenses=Apache-2.0",
"manifest:org.opencontainers.image.revision=64dca37637af3bc5106d8c860bc4355311818317",
"manifest:org.opencontainers.image.source=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.title=BuildKit",
"manifest:org.opencontainers.image.url=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.vendor=Moby",
"manifest:org.opencontainers.image.version=v0.24.0"
],
"attest": [
{
"type": "sbom"
},
{
"builder-id": "https://github.com/crazy-max/buildkit/actions/runs/16961922112/attempts/1",
"mode": "max",
"type": "provenance"
}
],
"context": ".",
"dockerfile": "Dockerfile",
"args": {
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
"DOCKER_META_IMAGES": "moby/buildkit",
"DOCKER_META_VERSION": "v0.24.0",
"GO_VERSION": "1.24"
},
"tags": [
"moby/buildkit:v0.24.0",
"moby/buildkit:latest"
],
"cache-from": [
{
"scope": "image",
"type": "gha"
}
],
"cache-to": [
{
"scope": "image",
"type": "gha"
}
],
"target": "",
"platforms": [
"linux/amd64",
"linux/arm/v7",
"linux/arm64",
"linux/s390x",
"linux/ppc64le",
"linux/riscv64"
],
"output": [
{
"type": "image"
}
]
}
}
}
image (rootless)
https://github.com/crazy-max/buildkit/actions/runs/16961922112/job/48076548571#step:6:1
{
"group": {
"default": {
"targets": [
"image-cross"
]
}
},
"target": {
"image-cross": {
"annotations": [
"manifest:org.opencontainers.image.created=2025-08-14T09:55:34.809Z",
"manifest:org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit",
"manifest:org.opencontainers.image.licenses=Apache-2.0",
"manifest:org.opencontainers.image.revision=64dca37637af3bc5106d8c860bc4355311818317",
"manifest:org.opencontainers.image.source=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.title=BuildKit",
"manifest:org.opencontainers.image.url=https://github.com/crazy-max/buildkit",
"manifest:org.opencontainers.image.vendor=Moby",
"manifest:org.opencontainers.image.version=v0.24.0-rootless"
],
"attest": [
{
"type": "sbom"
},
{
"builder-id": "https://github.com/crazy-max/buildkit/actions/runs/16961922112/attempts/1",
"mode": "max",
"type": "provenance"
}
],
"context": ".",
"dockerfile": "Dockerfile",
"args": {
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
"DOCKER_META_IMAGES": "moby/buildkit",
"DOCKER_META_VERSION": "v0.24.0-rootless",
"GO_VERSION": "1.24"
},
"tags": [
"moby/buildkit:v0.24.0-rootless",
"moby/buildkit:rootless"
],
"cache-from": [
{
"scope": "imagerootless",
"type": "gha"
}
],
"cache-to": [
{
"scope": "imagerootless",
"type": "gha"
}
],
"target": "rootless",
"platforms": [
"linux/amd64",
"linux/arm/v7",
"linux/arm64",
"linux/s390x",
"linux/ppc64le",
"linux/riscv64"
],
"output": [
{
"type": "image"
}
]
}
}
}
Signed-off-by: CrazyMax <[email protected]>
name: Build | ||
uses: docker/bake-action@v6 | ||
with: | ||
source: ${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't use Git context from our actions-toolkit: https://github.com/docker/actions-toolkit/blob/633bcf1936ffff0e05a4bbe2b23c71abf6f4111e/src/context.ts#L45-L60
Because currently it fetches by sha and not git ref so tags are not pulled: https://github.com/crazy-max/buildkit/actions/runs/16967780276/job/48096258733#step:7:440. That would therefore set a commit sha as BuildKit version: https://github.com/crazy-max/buildkit/actions/runs/16967780276/job/48096258733#step:7:1654
docker/actions-toolkit#677 would fix it but it's probably better to wait for #5974.
So in the meantime set Git context manually with full git ref as we currently do in our hack script:
Line 43 in ec7a152
currentcontext="https://github.com/$GITHUB_REPOSITORY.git#$GITHUB_REF" |
continue carrying changes from #3204