Skip to content

Build and push multi-platform docker image #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ jobs:
name: push image
command: |
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
make -C ./docker version=${CIRCLE_TAG} alias=latest push
make -C ./docker version=${CIRCLE_TAG} alias=${CIRCLE_TAG}-x64 only_alias=true push
make -C ./docker version=${CIRCLE_TAG} alias=latest only_alias=true push

publish-docker-image-arm64:
executor: linux_arm64
Expand All @@ -256,6 +257,16 @@ jobs:
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
make -C ./docker version=${CIRCLE_TAG} alias=${CIRCLE_TAG}-arm64 only_alias=true push

publish-docker-image-multiplatform:
executor: linux_arm64
steps:
- checkout
- run:
name: push image
command: |
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
make -C ./docker version=${CIRCLE_TAG} platforms="x64 arm64" push-multiplatform

test-bazel7-linux:
executor: ubuntu
environment:
Expand Down Expand Up @@ -334,6 +345,14 @@ workflows:
ignore: /.*/
tags:
only: /.*/
- publish-docker-image-multiplatform:
filters:
tags:
only: /.*/
requires:
- publish-docker-image-x64
- publish-docker-image-arm64

test-bazel7-linux:
jobs:
- test-bazel7-linux
Expand Down
8 changes: 8 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
version =
alias =
only_alias =
platforms =

image_name ?= emscripten/emsdk

Expand All @@ -29,3 +30,10 @@ ifdef alias
docker tag ${image_name}:${version} ${image_name}:${alias}
docker push ${image_name}:${alias}
endif

push-multiplatform: .TEST
ifndef platforms
$(error argument 'platforms' is not set. Please call `make platforms="SOME_PLATFORM1 SOME_PLATFORM2..." ...`)
endif
docker manifest create ${image_name}:${version} $(foreach platform,$(platforms),--amend ${image_name}:${version}-$(platform))
docker manifest push ${image_name}:${version}