Skip to content

Commit 96dacaf

Browse files
committed
ci: use docker github builder to build bin image
Signed-off-by: CrazyMax <[email protected]>
1 parent a2cf0ed commit 96dacaf

File tree

1 file changed

+31
-56
lines changed

1 file changed

+31
-56
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -407,68 +407,43 @@ jobs:
407407
path: ${{ env.DESTDIR }}/*
408408
if-no-files-found: error
409409

410-
bin-image:
410+
bin-image-prepare:
411411
runs-on: ubuntu-24.04
412+
outputs:
413+
repo-slug: ${{ env.REPO_SLUG }}
414+
steps:
415+
- run: echo "Exposing env vars"
416+
417+
bin-image:
418+
if: ${{ github.repository == 'docker/buildx' }}
419+
uses: docker/github-builder-experimental/.github/workflows/bake.yml@bake
412420
needs:
421+
- bin-image-prepare
413422
- test-integration
414423
- test-unit
415-
if: ${{ github.event_name != 'pull_request' && github.repository == 'docker/buildx' }}
416-
steps:
417-
-
418-
name: Free disk space
419-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
420-
with:
421-
android: true
422-
dotnet: true
423-
haskell: true
424-
large-packages: true
425-
swap-storage: true
426-
-
427-
name: Checkout
428-
uses: actions/checkout@v5
429-
-
430-
name: Set up QEMU
431-
uses: docker/setup-qemu-action@v3
432-
-
433-
name: Set up Docker Buildx
434-
uses: docker/setup-buildx-action@v3
435-
with:
436-
version: ${{ env.SETUP_BUILDX_VERSION }}
437-
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
438-
buildkitd-flags: --debug
439-
-
440-
name: Docker meta
441-
id: meta
442-
uses: docker/metadata-action@v5
443-
with:
444-
images: |
445-
${{ env.REPO_SLUG }}
446-
tags: |
447-
type=ref,event=branch
448-
type=ref,event=pr
449-
type=semver,pattern={{version}}
450-
bake-target: meta-helper
451-
-
452-
name: Login to DockerHub
453-
if: github.event_name != 'pull_request'
454-
uses: docker/login-action@v3
455-
with:
424+
permissions:
425+
contents: read
426+
id-token: write # for signing attestation manifests with GitHub OIDC Token
427+
packages: write # needed to push images to GitHub Container Registry
428+
with:
429+
target: image-cross
430+
output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
431+
cache: true
432+
cache-scope: bin-image
433+
set-meta-labels: true
434+
meta-images: |
435+
${{ needs.bin-image-prepare.outputs.repo-slug }}
436+
meta-tags: |
437+
type=ref,event=branch
438+
type=ref,event=pr
439+
type=semver,pattern={{version}}
440+
meta-bake-target: meta-helper
441+
bake-sbom: true
442+
secrets:
443+
registry-auths: |
444+
- registry: docker.io
456445
username: ${{ vars.DOCKERPUBLICBOT_USERNAME }}
457446
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
458-
-
459-
name: Build and push image
460-
uses: docker/bake-action@v6
461-
with:
462-
source: .
463-
files: |
464-
./docker-bake.hcl
465-
${{ steps.meta.outputs.bake-file }}
466-
targets: image-cross
467-
push: ${{ github.event_name != 'pull_request' }}
468-
sbom: true
469-
set: |
470-
*.cache-from=type=gha,scope=bin-image
471-
*.cache-to=type=gha,scope=bin-image,mode=max
472447
473448
scout:
474449
runs-on: ubuntu-24.04

0 commit comments

Comments
 (0)