Skip to content

Commit b2fe3f6

Browse files
authored
Merge pull request #153 from crazy-max/github-builder
ci: use docker github builder to build the image
2 parents aa22588 + fe8aab6 commit b2fe3f6

File tree

1 file changed

+39
-53
lines changed

1 file changed

+39
-53
lines changed

.github/workflows/ci.yaml

Lines changed: 39 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -19,62 +19,48 @@ env:
1919
BUILDKIT_IMAGE: moby/buildkit:latest
2020

2121
jobs:
22-
build:
23-
runs-on: ubuntu-latest
22+
build-prepare:
23+
runs-on: ubuntu-24.04
24+
outputs:
25+
repo-slug: ${{ env.DOCKERHUB_SLUG }}
2426
steps:
25-
-
26-
name: Checkout
27-
uses: actions/checkout@v6
28-
with:
29-
fetch-depth: 0
30-
-
31-
name: Set up QEMU
32-
uses: docker/setup-qemu-action@v3
33-
-
34-
name: Set up Docker Buildx
35-
uses: docker/setup-buildx-action@v3
36-
with:
37-
version: ${{ env.BUILDX_VERSION }}
38-
driver-opts: image=${{ env.BUILDKIT_IMAGE }}
39-
buildkitd-flags: --debug
40-
-
41-
name: Docker meta
42-
id: meta
43-
uses: docker/metadata-action@v5
44-
with:
45-
images: |
46-
${{ env.DOCKERHUB_SLUG }}
47-
tags: |
48-
type=semver,pattern={{version}}
49-
type=semver,pattern={{major}}.{{minor}}
50-
type=semver,pattern={{major}}
51-
type=ref,event=pr
52-
type=edge
53-
labels: |
54-
org.opencontainers.image.title=BuildKit Syft scanner
55-
org.opencontainers.image.description=SBOM generation for BuildKit images
56-
org.opencontainers.image.vendor=Docker Inc.
57-
-
58-
name: Login to DockerHub
59-
if: github.event_name != 'pull_request'
60-
uses: docker/login-action@v3
61-
with:
27+
# FIXME: can't use env object in reusable workflow inputs: https://github.com/orgs/community/discussions/26671
28+
- run: echo "Exposing env vars for reusable workflow"
29+
30+
build:
31+
uses: docker/github-builder-experimental/.github/workflows/bake.yml@5876e8deef3c899c298ec80b07c43dd9e89d37f6
32+
needs:
33+
- build-prepare
34+
permissions:
35+
contents: read # same as global permission
36+
id-token: write # for signing attestation(s) with GitHub OIDC Token
37+
with:
38+
setup-qemu: true
39+
target: image-all
40+
cache: true
41+
cache-scope: image
42+
output: image
43+
push: ${{ github.event_name != 'pull_request' }}
44+
sbom: true
45+
set-meta-labels: true
46+
meta-images: |
47+
${{ needs.build-prepare.outputs.repo-slug }}
48+
meta-tags: |
49+
type=semver,pattern={{version}}
50+
type=semver,pattern={{major}}.{{minor}}
51+
type=semver,pattern={{major}}
52+
type=ref,event=pr
53+
type=edge
54+
meta-annotations: |
55+
org.opencontainers.image.title=BuildKit Syft scanner
56+
org.opencontainers.image.description=SBOM generation for BuildKit images
57+
org.opencontainers.image.vendor=Docker Inc.
58+
meta-bake-target: meta-helper
59+
secrets:
60+
registry-auths: |
61+
- registry: docker.io
6262
username: ${{ vars.DOCKERPUBLICBOT_USERNAME }}
6363
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
64-
-
65-
name: Build
66-
uses: docker/bake-action@v6
67-
with:
68-
source: .
69-
files: |
70-
./docker-bake.hcl
71-
${{ steps.meta.outputs.bake-file }}
72-
targets: image-all
73-
push: ${{ github.event_name != 'pull_request' }}
74-
set: |
75-
*.cache-from=type=gha,scope=image
76-
*.cache-to=type=gha,scope=image
77-
*.attest=type=sbom
7864
7965
dockerhub-readme:
8066
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)