Skip to content

Commit d632f38

Browse files
committed
ci: use docker github builder to build bin image
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
1 parent bd719d6 commit d632f38

1 file changed

Lines changed: 23 additions & 41 deletions

File tree

.github/workflows/build.yml

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -98,50 +98,32 @@ jobs:
9898
if-no-files-found: error
9999

100100
bin-image:
101-
runs-on: ubuntu-24.04
102101
if: ${{ github.event_name != 'pull_request' && github.repository == 'docker/cli' }}
102+
uses: docker/github-builder/.github/workflows/bake.yml@27ade872c1e2296e62ef15ab3b10d37665e57cf7 # v1.15.0
103103
permissions:
104-
contents: read
105-
id-token: write
106-
steps:
107-
-
108-
name: Login to Docker Hub
109-
if: github.event_name != 'pull_request'
110-
uses: docker/login-action@06fb636fac595d6fb4b28a5dfcb21a6f5091859c # v4.5.0
111-
env:
112-
DOCKERHUB_OIDC_CONNECTIONID: ${{ vars.DOCKERHUB_OIDC_CONNECTIONID }}
113-
with:
104+
contents: read # same as global permission
105+
id-token: write # for signing attestation(s) and authenticating to Docker Hub with GitHub OIDC Token
106+
with:
107+
setup-qemu: true
108+
target: bin-image-cross
109+
cache: true
110+
cache-scope: bin-image
111+
output: image
112+
push: true
113+
vars: |
114+
VERSION=${{ github.ref }}
115+
meta-images: |
116+
dockereng/cli-bin
117+
meta-tags: |
118+
type=semver,pattern={{version}}
119+
type=ref,event=branch
120+
type=ref,event=pr
121+
type=semver,pattern={{major}}
122+
type=semver,pattern={{major}}.{{minor}}
123+
registry-identities: |
124+
- type: dockerhub
114125
username: dockereng
115-
-
116-
name: Set up QEMU
117-
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
118-
-
119-
name: Set up Docker Buildx
120-
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
121-
-
122-
name: Docker meta
123-
id: meta
124-
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
125-
with:
126-
images: dockereng/cli-bin
127-
tags: |
128-
type=semver,pattern={{version}}
129-
type=ref,event=branch
130-
type=ref,event=pr
131-
type=semver,pattern={{major}}
132-
type=semver,pattern={{major}}.{{minor}}
133-
-
134-
name: Build and push image
135-
uses: docker/bake-action@d3418bd7d0e9324001bca92fa8ba175ea7e6dc9b # v7.3.0
136-
with:
137-
files: |
138-
./docker-bake.hcl
139-
cwd://${{ steps.meta.outputs.bake-file }}
140-
targets: bin-image-cross
141-
push: ${{ github.event_name != 'pull_request' }}
142-
set: |
143-
*.cache-from=type=gha,scope=bin-image
144-
*.cache-to=type=gha,scope=bin-image,mode=max
126+
connection_id: ${{ vars.DOCKERHUB_OIDC_CONNECTIONID }}
145127
146128
prepare-plugins:
147129
runs-on: ubuntu-24.04

0 commit comments

Comments
 (0)