@@ -21,6 +21,10 @@ inputs:
2121 description : " Platform VERSION_ID / VERSION_CODENAME of the container
2222 (e.g. jammy, focal, etc.)"
2323 required : false
24+ arch :
25+ description : " Target architecture (amd64 or arm64)"
26+ default : " amd64"
27+ required : false
2428
2529runs :
2630 using : " composite"
2933 uses : " docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2"
3034
3135 - name : " Login to Image Registry"
32- uses : " docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 "
36+ uses : " docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 " # v4.1.0
3337 with :
3438 registry : " ${{inputs.image_registry}}"
3539 username : " ${{inputs.image_registry_username}}"
@@ -61,13 +65,32 @@ runs:
6165 with :
6266 images : " ${{inputs.image_registry}}/${{steps.sanitization.outputs.REPOSITORY}}\
6367 /${{steps.compute-meta.outputs.IMAGE_NAME}}"
68+ flavor : |
69+ suffix=-${{inputs.arch}}
70+
71+ - name : " Map arch to Docker platform"
72+ id : " map-arch"
73+ shell : " bash"
74+ run : |
75+ if [ "${{inputs.arch}}" = "arm64" ]; then
76+ echo "platform=linux/arm64" >> "$GITHUB_OUTPUT"
77+ elif [ "${{inputs.arch}}" = "amd64" ]; then
78+ echo "platform=linux/amd64" >> "$GITHUB_OUTPUT"
79+ else
80+ echo >&2 "ERROR: Unsupported arch '${{inputs.arch}}'. Must be 'amd64' or 'arm64'."
81+ exit 1
82+ fi
6483
6584 - name : " Build and Push"
6685 if : " github.event_name != 'pull_request' && github.ref == 'refs/heads/main'"
6786 uses : " docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4"
6887 with :
6988 context : " ./"
7089 file : " ${{steps.compute-meta.outputs.DOCKERFILE}}"
90+ platforms : " ${{steps.map-arch.outputs.platform}}"
91+ # Disable provenance to create a simple image instead of a manifest list.
92+ # This allows `docker manifest create` to combine the per-arch images later.
93+ provenance : false
7194 push : true
7295 tags : " ${{steps.extract-gh-meta.outputs.tags}}"
7396 labels : " ${{steps.extract-gh-meta.outputs.labels}}"
0 commit comments