66 - ' *'
77
88jobs :
9- build :
10- name : Build images
11- strategy :
12- matrix :
13- include :
14- - platform : linux/amd64
15- runner : ubuntu-24.04
16- arch : amd64
17- - platform : linux/arm64
18- runner : ubuntu-24.04-arm
19- arch : arm64
20- runs-on : ${{ matrix.runner }}
9+ build-and-push-image :
10+ runs-on : ubuntu-latest
2111 permissions :
2212 contents : read
2313 packages : write
2414
2515 steps :
16+ - name : Set up QEMU
17+ uses : docker/setup-qemu-action@v3
18+ with :
19+ platforms : ' arm64'
20+
2621 - name : Set up Docker Buildx
2722 uses : docker/setup-buildx-action@v3
2823
2924 - name : Checkout repository
3025 uses : actions/checkout@v4
3126
27+ - name : Log in to Docker Hub
28+ uses : docker/login-action@v3
29+ with :
30+ username : ${{ secrets.DOCKER_USERNAME }}
31+ password : ${{ secrets.DOCKER_PASSWORD }}
32+
33+ - name : Log in to the Container registry
34+ uses : docker/login-action@v3
35+ with :
36+ registry : ghcr.io
37+ username : ${{ github.actor }}
38+ password : ${{ secrets.GITHUB_TOKEN }}
39+
3240 - name : Extract tags and labels for Docker
3341 id : meta
3442 uses : docker/metadata-action@v5
@@ -37,49 +45,11 @@ jobs:
3745 openhv/server
3846 ghcr.io/${{ github.repository }}
3947
40- - name : Build ${{ matrix.arch }} image
48+ - name : Build and push Docker image
4149 uses : docker/build-push-action@v6
4250 with :
4351 context : .
44- push : false
45- platforms : ${{ matrix.platform }}
46- tags : ${{ steps.meta.outputs.tags }}-${{ matrix.arch }}
52+ platforms : linux/amd64, linux/arm64
53+ push : true
54+ tags : ${{ steps.meta.outputs.tags }}
4755 labels : ${{ steps.meta.outputs.labels }}
48-
49- combine :
50- name : Combine platforms
51- runs-on : ubuntu-latest
52- needs : [build]
53-
54- steps :
55- - uses : actions/checkout@v4
56-
57- - name : Log in to Docker Hub
58- uses : docker/login-action@v3
59- with :
60- username : ${{ secrets.DOCKER_USERNAME }}
61- password : ${{ secrets.DOCKER_PASSWORD }}
62-
63- - name : Log in to the Container registry
64- uses : docker/login-action@v3
65- with :
66- registry : ghcr.io
67- username : ${{ github.actor }}
68- password : ${{ secrets.GITHUB_TOKEN }}
69-
70- - name : Extract tags and labels for Docker
71- id : meta
72- uses : docker/metadata-action@v5
73- with :
74- images : |
75- openhv/server
76- ghcr.io/${{ github.repository }}
77-
78- - name : Create manifest and push
79- run : |
80- for tag in $(echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n'); do
81- docker manifest create $tag \
82- --amend $tag-amd64 \
83- --amend $tag-arm64
84- docker manifest push $tag
85- done
0 commit comments