diff --git a/.cirrus.yml b/.cirrus.yml index 16955b73..f3fc8600 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -54,12 +54,12 @@ multi_arch_build_task: - docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD setup_script: - docker run -t --rm --privileged tonistiigi/binfmt --install all - - docker buildx create --name multibuilder + - docker buildx create --name multibuilder --driver docker-container - docker buildx use multibuilder - docker buildx inspect --bootstrap build_script: - echo "Build the ${STAGING_IMAGE_NAME}:${tag} image supporting two architectures, linux/amd64 and linux/arm64" - - docker buildx build --platform linux/amd64,linux/arm64 --tag "${STAGING_IMAGE_NAME}:${tag}" --push ${version} + - .cirrus/multi-arch-build.sh ${STAGING_IMAGE_NAME} ${tag} ${version} private_scan_task: env: diff --git a/.cirrus/multi-arch-build.sh b/.cirrus/multi-arch-build.sh new file mode 100755 index 00000000..ad2bad04 --- /dev/null +++ b/.cirrus/multi-arch-build.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +export DOCKER_BUILDKIT=1 +for i in $(seq 1 3); do + if docker buildx build --platform linux/amd64,linux/arm64 --tag "$1:$2" --push $3; then + echo "[Success]: Buildx, attempt ${i}" + exit 0 + fi + sleep 3 +done +echo "[Error]: Context Deadline Exceeded - Buildx" +exit 1 \ No newline at end of file