88 description : ' The name of the artifact to upload'
99 required : true
1010 type : string
11+ platform :
12+ description : ' The platform to build the image for'
13+ required : true
14+ type : string
1115
1216permissions :
1317 contents : read
2226 steps :
2327 - name : Checkout
2428 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
2533 - name : Set up Docker Buildx
2634 uses : docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3
2735 - name : Download artifact
@@ -43,13 +51,13 @@ jobs:
4351 run : |
4452 git lfs install
4553 git lfs pull
46- - name : Test build on x86
54+ - name : Test build - ${{ inputs.platform }}
4755 id : docker_build
4856 uses : docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v5
4957 with :
5058 context : .
5159 file : ./Dockerfile
52- platforms : linux/amd64
60+ platforms : ${{ inputs.platform }}
5361 push : false # Only attempt to build, to verify the Dockerfile is working
5462 load : true
5563 cache-from : type=gha
@@ -58,12 +66,16 @@ jobs:
5866 LATEST_RELEASE=${{ env.LATEST_RELEASE }}
5967 tags : ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
6068 - 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' }}
6171 run : |
6272 # List all images
6373 docker images
6474 # Save the image as a tarball
6575 docker save -o image.tar ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
6676 - 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' }}
6779 uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
6880 with :
6981 name : ${{ inputs.artifact-name }}
0 commit comments