Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancole committed Dec 6, 2020
1 parent 0e26256 commit 3f39737
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions build-bin/docker/configure_docker_push
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# the License.
#

# Ensures Docker is logged in, buildx is available and it can build multi-architecture.
# Ensures Docker is logged in and it can build multi-architecture.
# This should be used instead of `configure_docker` when a push will occur.
#
# This should only happen when we are publishing multi-arch builds, as otherwise the setup could use
Expand All @@ -32,7 +32,7 @@ fi
echo '{ "experimental":true, "registry-mirrors": ["https://mirror.gcr.io"] }' | sudo tee /etc/docker/daemon.json

sudo service docker restart
# Enable experimental client features (eg docker buildx)
# Enable experimental client features (multi-arch)
mkdir -p ${HOME}/.docker && echo '{"experimental":"enabled"}' > ${HOME}/.docker/config.json

# Log in to GitHub Container Registry and Docker Hub for releasing images
Expand Down
18 changes: 9 additions & 9 deletions build-bin/docker/docker_arch
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@

set -ue

# Normalize arch to what's available
arch=${ARCH:-$(uname -m)}
case ${arch} in
# Normalize docker_arch to what's available
docker_arch=${DOCKER_ARCH:-$(uname -m)}
case ${docker_arch} in
amd64* )
arch=amd64
docker_arch=amd64
;;
x86_64* )
arch=amd64
docker_arch=amd64
;;
arm64* )
arch=arm64
docker_arch=arm64
;;
aarch64* )
arch=arm64
docker_arch=arm64
;;
* )
>&2 echo "Unsupported arch: ${arch}"
>&2 echo "Unsupported DOCKER_ARCH: ${docker_arch}"
exit 1;
esac

echo ${arch}
echo ${docker_arch}
3 changes: 2 additions & 1 deletion build-bin/docker/docker_build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ docker_tag=${1?full docker_tag is required. Ex openzipkin/zipkin:test}
version=${2:-}
docker_args=$($(dirname "$0")/docker_args ${version})

# Avoid buildx on load for two reasons:
# Avoid buildx on load for reasons including:
# * Caching is more complex as builder instances must be considered
# * It only supports one platform/arch on load https://github.com/docker/buildx/issues/59
# * It would pull Docker Hub for moby/buildkit or multiarch/qemu-user-static images, using up quota
echo "Building image ${docker_tag}"
Expand Down
8 changes: 6 additions & 2 deletions build-bin/docker/docker_push
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
# When a release, and DOCKER_RELEASE_REPOS is unset they also push to Docker Hub (docker.io).
#
# Note: In CI, `configure_docker_push` must be called before invoking this.

#
# Avoid buildx on push for reasons including:
# * Caching is more complex as builder instances must be considered
# * Platform builds run in parallel, leading to port conflict failures (ex in cassandra)
# * 0.4.2 multi-platform builds have failed due to picking the wrong image for a FROM instruction
set -ue

docker_image=${1?docker_image is required, notably without a tag. Ex openzipkin/zipkin}
Expand Down Expand Up @@ -60,7 +64,7 @@ for repo in ${docker_repos}; do
done

docker_args=$($(dirname "$0")/docker_args ${version})
docker_archs=${DOCKER_PLATFORMS:-amd64 arm64}
docker_archs=${DOCKER_ARCHS:-amd64 arm64}

echo "Will build the following architectures: ${docker_archs}"

Expand Down

0 comments on commit 3f39737

Please sign in to comment.