Skip to content

Commit 5bfe491

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 5bfe491

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/images.yaml

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

0 commit comments

Comments
 (0)