|
19 | 19 | BUILDKIT_IMAGE: moby/buildkit:latest |
20 | 20 |
|
21 | 21 | 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 }} |
24 | 26 | 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 |
62 | 62 | username: ${{ vars.DOCKERPUBLICBOT_USERNAME }} |
63 | 63 | 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 |
78 | 64 |
|
79 | 65 | dockerhub-readme: |
80 | 66 | runs-on: ubuntu-latest |
|
0 commit comments