From 625d549a60e61258fcd7d712b0db0a9fbea9d41f Mon Sep 17 00:00:00 2001 From: Adam Drew Date: Tue, 7 Nov 2023 09:24:59 -0500 Subject: [PATCH] No, just gonna to it this way --- build_deploy.sh | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/build_deploy.sh b/build_deploy.sh index 6b0f18ae..0027d020 100755 --- a/build_deploy.sh +++ b/build_deploy.sh @@ -4,20 +4,6 @@ set -exv IMAGE="quay.io/cloudservices/frontend-operator" IMAGE_TAG=$(git rev-parse --short=7 HEAD) -# Generate a unique builder name using Jenkins environment variables -BUILDER_NAME="builder-${JOB_NAME}-${BUILD_ID}" - -# Function to remove Docker builder -cleanup() { - echo "Cleaning up Docker builder..." - # Check if the specified builder exists and remove it if it does - docker 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 if [[ -z "$QUAY_USER" || -z "$QUAY_TOKEN" ]]; then echo "QUAY_USER and QUAY_TOKEN must be set" @@ -54,15 +40,14 @@ fi #### End +docker buildx use multiarchbuilder + -# Create a new buildx builder with the unique name -docker buildx create --name "${BUILDER_NAME}" --use --driver docker-container --driver-opt image=quay.io/domino/buildkit:v0.12.3 +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 . -# Initialize the builder -docker buildx inspect "${BUILDER_NAME}" --bootstrap +docker --config="$DOCKER_CONF" manifest create "${IMAGE}:${IMAGE_TAG}" \ + "${IMAGE}:${IMAGE_TAG}-amd64" \ + "${IMAGE}:${IMAGE_TAG}-arm64" -# Build and push the multi-architecture image -docker --config="$DOCKER_CONF" buildx build --builder "${BUILDER_NAME}" \ - --platform linux/amd64,linux/arm64 \ - --build-arg BASE_IMAGE="$BASE_IMG" \ - -t "${IMAGE}:${IMAGE_TAG}" --push . +docker --config="$DOCKER_CONF" manifest push "${IMAGE}:${IMAGE_TAG}" \ No newline at end of file