15
15
IMAGE_NAME : ${{ github.repository }}
16
16
17
17
jobs :
18
- build-and-push-image :
19
- runs-on : ubuntu-latest
18
+ build :
19
+ strategy :
20
+ matrix :
21
+ os : ["ubuntu-latest", "ubuntu-24.04-arm"]
22
+ runs-on : ${{ matrix.os }}
23
+
20
24
permissions :
21
25
contents : read
22
26
packages : write
@@ -38,11 +42,19 @@ jobs:
38
42
username : ${{ github.actor }}
39
43
password : ${{ secrets.GITHUB_TOKEN }}
40
44
45
+ - name : Set architecture tag (amd64)
46
+ if : ${{ matrix.os == 'ubuntu-latest' }}
47
+ run : echo "ARCH_TAG=amd64" >> $GITHUB_ENV
48
+
49
+ - name : Set architecture tag (arm64)
50
+ if : ${{ contains(matrix.os, 'arm') }}
51
+ run : echo "ARCH_TAG=arm64" >> $GITHUB_ENV
52
+
41
53
- name : Extract metadata (tags, labels) for Docker
42
54
id : meta
43
55
uses : docker/metadata-action@v5
44
56
with :
45
- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
57
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.os }}
46
58
47
59
- name : Build Docker image
48
60
uses : docker/build-push-action@v6
@@ -54,14 +66,36 @@ jobs:
54
66
platforms : linux/amd64
55
67
tags : ${{ steps.meta.outputs.tags }}
56
68
labels : ${{ steps.meta.outputs.labels }}
69
+ outputs : type=docker, dest=${{ runner.temp }}/image.tar
57
70
58
- - name : Build (arm) and push (amd/arm) Docker image
59
- uses : docker/build-push-action@v6
60
- if : github.event_name == 'push'
71
+ - name : Upload artifact
72
+ uses : actions/upload-artifact@v4
61
73
with :
62
- context : .
63
- push : true
64
- file : docker/Dockerfile
65
- platforms : linux/amd64,linux/arm64
66
- tags : ${{ steps.meta.outputs.tags }}
67
- labels : ${{ steps.meta.outputs.labels }}
74
+ name : ${{ matrix.os}}
75
+ path : ${{ runner.temp }}/image.tar
76
+
77
+ push :
78
+ runs-on : ubuntu-latest
79
+ needs : build
80
+ steps :
81
+ - name : Download (AMD) artifact
82
+ uses : actions/download-artifact@v4
83
+ with :
84
+ name : " ubuntu-latest"
85
+ path : ${{ runner.temp }}
86
+
87
+ - name : Load image (amd)
88
+ run : |
89
+ docker load --input ${{ runner.temp }}/ubuntu-latest.tar
90
+ docker image ls -a
91
+
92
+ - name : Download (ARM) artifact
93
+ uses : actions/download-artifact@v4
94
+ with :
95
+ name : " ubuntu-24.04-arm"
96
+ path : ${{ runner.temp }}
97
+
98
+ - name : Load image (arm)
99
+ run : |
100
+ docker load --input ${{ runner.temp }}/ubuntu-24.04-arm.tar
101
+ docker image ls -a
0 commit comments