Skip to content

Commit a0da9d6

Browse files
committed
ci: add workflow to build and push release multi-arch Docker images
Rather than letting Dockerhub build the images (which only suppports building amd64 in the subscription the Cilium project is using), use a GitHub actions workflow to build and push Docker images for amd64 and arm64 on release. Signed-off-by: Tobias Klauser <[email protected]>
1 parent abaa2a4 commit a0da9d6

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/images.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Image Release Build
2+
3+
on:
4+
pull_request: {}
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build-and-push-prs:
15+
if: ${{ github.repository == 'cilium/pwru' }}
16+
environment: ${{ github.ref_type == 'tag' && 'release' }}
17+
runs-on: ubuntu-24.04
18+
19+
steps:
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@18ce135bb5112fa8ce4ed6c17ab05699d7f3a5e0 # v3.11.0
22+
23+
- name: Login to DockerHub
24+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
25+
with:
26+
username: ${{ secrets.DOCKER_HUB_RELEASE_USERNAME }}
27+
password: ${{ secrets.DOCKER_HUB_RELEASE_PASSWORD }}
28+
29+
- name: Getting image tag
30+
id: tag
31+
run: |
32+
tag=${GITHUB_REF##*/}
33+
echo tag=$tag >> $GITHUB_OUTPUT
34+
echo image_tags=${{ github.repository_owner }}/pwru:$tag,quay.io/${{ env.QUAY_ORGANIZATION }}/${{ matrix.name }}:$tag >> $GITHUB_OUTPUT
35+
36+
- name: Checkout Source Code
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38+
with:
39+
ref: ${{ steps.tag.outputs.tag }}
40+
41+
- name: Docker Build
42+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
43+
with:
44+
context: .
45+
file: ./Dockerfile
46+
platforms: linux/arm64,linux/amd64
47+
push: ${{ github.event_name == 'push' }}
48+
tags: ${{ steps.tag.outputs.image_tags }}

0 commit comments

Comments
 (0)