diff --git a/build-and-push.gitlab-ci.yml b/build-and-push.gitlab-ci.yml index 5bf6a1fd810c6553288290d05e822b4549ab4869..28cdb68eb064c321136aad1e4f62945560a7bccb 100644 --- a/build-and-push.gitlab-ci.yml +++ b/build-and-push.gitlab-ci.yml @@ -9,10 +9,7 @@ - apk update - apk add bash gettext # for envsubst command - apk add jq # for querying manifests - # The official docs state that `docker buildx create --use` should be enough on its own. However, there appears to be - # a bug which, even though this issue is closed https://github.com/docker/buildx/issues/584#issuecomment-830041059, - # still requires this `docker run --rm` workaround. - - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes || true; docker buildx create --use + - ./prep-buildx.sh script: - ./build.sh variables: diff --git a/prep-buildx.sh b/prep-buildx.sh new file mode 100755 index 0000000000000000000000000000000000000000..4d7aaecd9fd613bdddcf51ddce5d322f4a17dfb6 --- /dev/null +++ b/prep-buildx.sh @@ -0,0 +1,19 @@ +#! /bin/bash + +set -ex + +# Change max-parallelism to 1 if building multiple archs + +echo "[worker.oci]" > /etc/buildkitd.toml + +if [[ $IMAGE_ARCHS == *","* ]]; then + echo "Setting max-parallelism to 1 as building multiple archs" + echo " max-parallelism = 1" >> /etc/buildkitd.toml +fi + +# The official docs state that `docker buildx create --use` should be enough on its own. However, there appears to be +# a bug which, even though this issue is closed https://github.com/docker/buildx/issues/584#issuecomment-830041059, +# still requires this `docker run --rm` workaround. +docker run --rm --privileged multiarch/qemu-user-static --reset -p yes || true; docker buildx create --config /etc/buildkitd.toml --use + +docker buildx inspect --bootstrap