Skip to content

Commit 6df7f44

Browse files
committed
Build per platform again.
1 parent 31c0ee4 commit 6df7f44

File tree

1 file changed

+60
-17
lines changed

1 file changed

+60
-17
lines changed

.github/workflows/docker.yml

Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@ on:
77

88
jobs:
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
@@ -19,19 +29,6 @@ jobs:
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,57 @@ 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
4844
push: true
49-
tags: ${{ steps.meta.outputs.tags }}
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+
strategy:
52+
matrix:
53+
include:
54+
- platform: linux/amd64
55+
runner: ubuntu-24.04
56+
arch: amd64
57+
- platform: linux/arm64
58+
runner: ubuntu-24.04-arm
59+
arch: arm64
60+
runs-on: ubuntu-latest
61+
needs: [build]
62+
63+
steps:
64+
- uses: actions/checkout@v4
65+
66+
- name: Log in to Docker Hub
67+
uses: docker/login-action@v3
68+
with:
69+
username: ${{ secrets.DOCKER_USERNAME }}
70+
password: ${{ secrets.DOCKER_PASSWORD }}
71+
72+
- name: Log in to the Container registry
73+
uses: docker/login-action@v3
74+
with:
75+
registry: ghcr.io
76+
username: ${{ github.actor }}
77+
password: ${{ secrets.GITHUB_TOKEN }}
78+
79+
- name: Extract tags and labels for Docker
80+
id: meta
81+
uses: docker/metadata-action@v5
82+
with:
83+
images: |
84+
openhv/server
85+
ghcr.io/${{ github.repository }}
86+
87+
- name: Create ${{ matrix.arch }} manifest and push
88+
run: |
89+
docker manifest create openhv/server:${{ steps.meta.outputs.tags }} \
90+
--amend openhv/server:${{ steps.meta.outputs.tags }}-amd64 \
91+
--amend openhv/server:${{ steps.meta.outputs.tags }}-arm64
92+
93+
docker manifest push ${{ steps.meta.outputs.labels }}${{ matrix.arch }}

0 commit comments

Comments
 (0)