From 6224bdb7ea8b130ef26503be0e12749b82d31e66 Mon Sep 17 00:00:00 2001 From: Adam Drew Date: Tue, 7 Nov 2023 11:11:04 -0500 Subject: [PATCH] Thrashing --- build_deploy.sh | 43 +++++++++++-------------------------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/build_deploy.sh b/build_deploy.sh index 2b34f78e..59fbf6c6 100755 --- a/build_deploy.sh +++ b/build_deploy.sh @@ -20,31 +20,10 @@ DOCKER_CONF="$PWD/.docker" mkdir -p "$DOCKER_CONF" +docker buildx use multiarchbuilder -# Function to remove Docker builder -cleanup() { - echo "Cleaning up Docker builder..." - # Check if the specified builder exists and remove it if it does - docker --config="$DOCKER_CONF" buildx inspect "$BUILDER_NAME" &>/dev/null && docker buildx rm "$BUILDER_NAME" -} - -# Create a trap for different signals -# It will call the cleanup function on EXIT, or if the script receives -# a SIGINT (Ctrl+C), or a SIGTERM (termination signal) -trap cleanup EXIT SIGINT SIGTERM - - -# Create a new buildx builder with the unique name -docker --config="$DOCKER_CONF" buildx create --platform linux/amd64,linux/arm64 --name "$BUILDER_NAME" --use --driver docker-container --driver-opt image=quay.io/domino/buildkit:v0.12.3 - -# Initialize the builder -docker --config="$DOCKER_CONF" buildx inspect "$BUILDER_NAME" --bootstrap - - -docker --config="$DOCKER_CONF" buildx use "$BUILDER_NAME" - -docker --config="$DOCKER_CONF" login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io -docker --config="$DOCKER_CONF" login -u="$RH_REGISTRY_USER" -p="$RH_REGISTRY_TOKEN" registry.redhat.io +docker login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io +docker login -u="$RH_REGISTRY_USER" -p="$RH_REGISTRY_TOKEN" registry.redhat.io ### Start base image build and push BASE_TAG=`cat go.mod go.sum Dockerfile.base | sha256sum | head -c 8` @@ -58,21 +37,21 @@ echo "received HTTP response: $RESPONSE" VALID_TAGS_LENGTH=$(echo $RESPONSE | jq '[ .tags[] | select(.end_ts == null) ] | length') if [[ "$VALID_TAGS_LENGTH" -eq 0 ]]; then - docker --config="$DOCKER_CONF" buildx build --platform linux/amd64 -f Dockerfile.base -t "${BASE_IMG}-amd64" --push . - docker --config="$DOCKER_CONF" buildx build --platform linux/arm64 -f Dockerfile.base -t "${BASE_IMG}-arm64" --push . - docker --config="$DOCKER_CONF" manifest create "${BASE_IMG}" \ + docker buildx build --platform linux/amd64 -f Dockerfile.base -t "${BASE_IMG}-amd64" --push . + docker buildx build --platform linux/arm64 -f Dockerfile.base -t "${BASE_IMG}-arm64" --push . + docker manifest create "${BASE_IMG}" \ "${BASE_IMG}-amd64" \ "${BASE_IMG}-arm64" - docker --config="$DOCKER_CONF" push "$BASE_IMG" + docker push "$BASE_IMG" fi #### End -docker --config="$DOCKER_CONF" buildx build --platform linux/amd64 --build-arg BASE_IMAGE="$BASE_IMG" --build-arg GOARCH="amd64" -t "${IMAGE}:${IMAGE_TAG}-amd64" --push . -docker --config="$DOCKER_CONF" buildx build --platform linux/arm64 --build-arg BASE_IMAGE="$BASE_IMG" --build-arg GOARCH="arm64" -t "${IMAGE}:${IMAGE_TAG}-arm64" --push . +docker buildx build --platform linux/amd64 --build-arg BASE_IMAGE="$BASE_IMG" --build-arg GOARCH="amd64" -t "${IMAGE}:${IMAGE_TAG}-amd64" --push . +docker buildx build --platform linux/arm64 --build-arg BASE_IMAGE="$BASE_IMG" --build-arg GOARCH="arm64" -t "${IMAGE}:${IMAGE_TAG}-arm64" --push . -docker --config="$DOCKER_CONF" manifest create "${IMAGE}:${IMAGE_TAG}" \ +docker manifest create "${IMAGE}:${IMAGE_TAG}" \ "${IMAGE}:${IMAGE_TAG}-amd64" \ "${IMAGE}:${IMAGE_TAG}-arm64" -docker --config="$DOCKER_CONF" manifest push "${IMAGE}:${IMAGE_TAG}" \ No newline at end of file +docker manifest push "${IMAGE}:${IMAGE_TAG}" \ No newline at end of file