Build and push multi-platform docker image (#1567)

This PR adds the `publish-docker-image-multiplatform` CI job step that
pushes a multi-platform docker image when a new tag is created. #1211

Unfortunately, this is not as simple as pushing two images targeting
different platforms to the same tag. There are a couple of ways to
create a multi-platform image:
- Using `docker buildx` to build images for all platforms. To do this
images targeting non-native platforms would need to be built using QEMU
(slower), a remote machine or cross-compilation.
- Building and publishing platform-specific images
`emscripten/emsdk-x64`, `emscripten/emsdk-arm64` and then creating a
manifest that links to these images. This is the simpler solution to
implement, and is what this PR does.

Tested with CircleCI on my fork. See the pushed images at
[radiantly/emsdk ·
DockerHub](https://hub.docker.com/r/radiantly/emsdk/tags)
This commit is contained in:
Joshua T.
2025-09-25 23:21:45 +05:30
committed by GitHub
parent 389a68bc35
commit 44f11eac54
2 changed files with 23 additions and 2 deletions

View File

@@ -29,3 +29,7 @@ ifdef alias
docker tag ${image_name}:${version} ${image_name}:${alias}
docker push ${image_name}:${alias}
endif
push-multiplatform: .TEST
docker manifest create ${image_name}:${version} $(foreach platform,x64 arm64,--amend ${image_name}:${version}-$(platform))
docker manifest push ${image_name}:${version}