Skip to content
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

[dockerhub] push arm64 images too, with multiarch tags #453

Merged
merged 1 commit into from
Jun 27, 2021
Merged
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
25 changes: 23 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ go_image(

container_image(
name = "bazel-remote-image",
architecture = "amd64",
base = ":bazel-remote-base",
cmd = ["--max_size=5"],
entrypoint = [
Expand All @@ -92,6 +93,7 @@ container_image(

container_image(
name = "bazel-remote-image-arm64",
architecture = "arm64",
base = ":bazel-remote-base-arm64",
cmd = ["--max_size=1"],
entrypoint = [
Expand All @@ -113,12 +115,31 @@ container_image(
visibility = ["//visibility:public"],
)

# The following container_push targets push to "tmp-amd64" and "tmp-arm64"
# tags, so they can be combined into a multiarch tag on dockerhub. This
# isn't currently possible with rules_docker, so instead we rely on some
# external commands to be run after the tmp-* tags are pushed. See the
# docker/push_to_dockerhub script.
#
# Background:
# https://github.com/bazelbuild/rules_docker/issues/1599

container_push(
name = "push_to_dockerhub",
name = "push_to_dockerhub_amd64",
format = "Docker",
image = ":bazel-remote-image",
registry = "index.docker.io",
repository = "buchgr/bazel-remote-cache",
tag = "latest",
tag = "tmp-amd64",
visibility = ["//visibility:public"],
)

container_push(
name = "push_to_dockerhub_arm64",
format = "Docker",
image = ":bazel-remote-image-arm64",
registry = "index.docker.io",
repository = "buchgr/bazel-remote-cache",
tag = "tmp-arm64",
visibility = ["//visibility:public"],
)
19 changes: 19 additions & 0 deletions docker/push_to_dockerhub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

script_dir=$(dirname "${BASH_SOURCE[0]}")
cd "${script_dir}/.."

# push test-amd64 and test-arm64 images.
bazel run //:push_to_dockerhub_amd64
bazel run //:push_to_dockerhub_arm64

# Create the multiarch manifest.
docker manifest rm buchgr/bazel-remote-cache:latest
docker manifest create buchgr/bazel-remote-cache:latest \
--amend buchgr/bazel-remote-cache:tmp-amd64 \
--amend buchgr/bazel-remote-cache:tmp-arm64

# Push the multiarch manifest
docker manifest push buchgr/bazel-remote-cache:latest

echo "Go ahead and delete the tmp-amd64 and tmp-arm64 images from the web ui"