77
88jobs :
99 build :
10- runs-on : ubuntu-24.04
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 }}
1121 permissions :
1222 contents : read
1323 packages : write
1929 - name : Checkout repository
2030 uses : actions/checkout@v4
2131
22- - name : Log in to Docker Hub
23- uses : docker/login-action@v3
24- with :
25- username : ${{ secrets.DOCKER_USERNAME }}
26- password : ${{ secrets.DOCKER_PASSWORD }}
27-
28- - name : Log in to the Container registry
29- uses : docker/login-action@v3
30- with :
31- registry : ghcr.io
32- username : ${{ github.actor }}
33- password : ${{ secrets.GITHUB_TOKEN }}
34-
3532 - name : Extract tags and labels for Docker
3633 id : meta
3734 uses : docker/metadata-action@v5
@@ -40,11 +37,48 @@ jobs:
4037 openhv/server
4138 ghcr.io/${{ github.repository }}
4239
43- - name : Build and push Docker image
40+ - name : Build ${{ matrix.arch }} image
4441 uses : docker/build-push-action@v6
4542 with :
4643 context : .
47- platforms : linux/amd64,linux/arm64
48- push : true
49- tags : ${{ steps.meta.outputs.tags }}
44+ push : false
45+ platforms : ${{ matrix.platform }}
46+ tags : ${{ steps.meta.outputs.tags }}-${{ matrix.arch }}
5047 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+ docker manifest create ${{ steps.meta.outputs.tags }} \
81+ --amend ${{ steps.meta.outputs.tags }}-amd64 \
82+ --amend ${{ steps.meta.outputs.tags }}-arm64
83+
84+ docker manifest push ${{ steps.meta.outputs.labels }}
0 commit comments