Skip to content

Commit

Permalink
Revert use of build kit
Browse files Browse the repository at this point in the history
In #11, I tried to find a configuration that works both in Docker 19
and 20. However, this breaks the build.

This reverts the change as there are bugs popping up related on Docker
20 anyway, such as docker/buildx#475

We use Docker from the OS distribution, so unlikely to accidentally
walk into a Docker 20. In other words, when it becomes stable, we can
try again.
  • Loading branch information
adriancole committed Dec 17, 2020
1 parent db79ca9 commit 31b4d18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
16 changes: 2 additions & 14 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 All @@ -46,21 +46,9 @@ if [ -n "${DOCKERHUB_USER:-}" ]; then
echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USER}" --password-stdin
fi

# Connection resets are frequent in GitHub Actions workflows
alias wget="wget --random-wait --tries=5 -qO-"

# Latest version from https://github.com/docker/buildx/releases
buildx_version=0.5.1
buildx_url=https://github.com/docker/buildx/releases/download/v${buildx_version}/buildx-v${buildx_version}.linux-${arch}
mkdir -p $HOME/.docker/cli-plugins
( cd $HOME/.docker/cli-plugins && wget ${buildx_url} > docker-buildx && chmod 755 docker-buildx)
docker version

# Enable execution of different multi-architecture containers by QEMU and binfmt_misc
# See https://github.com/multiarch/qemu-user-static
#
# Mirrored image use to avoid docker.io pulls:
# docker tag multiarch/qemu-user-static:5.1.0-7 ghcr.io/openzipkin/multiarch-qemu-user-static:latest
docker run --rm --privileged ghcr.io/openzipkin/multiarch-qemu-user-static --reset -p yes
# don't fail if there's already a builder
docker buildx create --name builder --use || true
12 changes: 6 additions & 6 deletions build-bin/docker/docker_push
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
#
# Note: In CI, `configure_docker_push` must be called before invoking this.
#
# Avoid buildx because builds run in parallel, leading to port conflict failures (ex in cassandra)
# 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}
version=${2:-master}

# We don't need build kit, but Docker 20.10 no longer accepts --platform without it.
# It is simpler to just always enable it. See https://github.com/moby/moby/issues/41552
export DOCKER_BUILDKIT=1
export DOCKER_BUILDKIT=0

case ${version} in
master )
Expand Down Expand Up @@ -73,7 +73,7 @@ arch_tags=""
for docker_arch in ${docker_archs}; do
arch_tag=${docker_image}:${docker_tag0}-${docker_arch}
echo "Building tag ${arch_tag}..."
docker build --progress=plain --pull ${docker_args} --platform linux/${docker_arch} --tag ${arch_tag} .
docker build --pull ${docker_args} --platform linux/${docker_arch} --tag ${arch_tag} .
arch_tags="${arch_tags} ${arch_tag}"
done

Expand Down

0 comments on commit 31b4d18

Please sign in to comment.