8
8
description : ' The name of the artifact to upload'
9
9
required : true
10
10
type : string
11
+ platform :
12
+ description : ' The platform to build the image for'
13
+ required : true
14
+ type : string
11
15
12
16
permissions :
13
17
contents : read
22
26
steps :
23
27
- name : Checkout
24
28
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
29
+ - name : Set up QEMU for cross-platform builds
30
+ # Only set up QEMU if the platform is not linux/amd64
31
+ if : ${{ inputs.platform != 'linux/amd64' }}
32
+ uses : docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 # v3
25
33
- name : Set up Docker Buildx
26
34
uses : docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3
27
35
- name : Download artifact
@@ -43,13 +51,13 @@ jobs:
43
51
run : |
44
52
git lfs install
45
53
git lfs pull
46
- - name : Test build on x86
54
+ - name : Test build - ${{ inputs.platform }}
47
55
id : docker_build
48
56
uses : docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v5
49
57
with :
50
58
context : .
51
59
file : ./Dockerfile
52
- platforms : linux/amd64
60
+ platforms : ${{ inputs.platform }}
53
61
push : false # Only attempt to build, to verify the Dockerfile is working
54
62
load : true
55
63
cache-from : type=gha
@@ -58,12 +66,16 @@ jobs:
58
66
LATEST_RELEASE=${{ env.LATEST_RELEASE }}
59
67
tags : ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
60
68
- name : Save Docker image as a tarball
69
+ # Only save the image if the build was for linux/amd64, as we only need it for the integration tests
70
+ if : ${{ inputs.platform == 'linux/amd64' }}
61
71
run : |
62
72
# List all images
63
73
docker images
64
74
# Save the image as a tarball
65
75
docker save -o image.tar ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
66
76
- name : Upload Docker image artifact
77
+ # Only upload the image if the build was for linux/amd64, as we only need it for the integration tests
78
+ if : ${{ inputs.platform == 'linux/amd64' }}
67
79
uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
68
80
with :
69
81
name : ${{ inputs.artifact-name }}
0 commit comments