From baf6e56ae0b1708a0c7e12ebf2c9af63847cc2f5 Mon Sep 17 00:00:00 2001 From: PhilWindle Date: Tue, 12 Sep 2023 16:52:45 +0000 Subject: [PATCH] WIP --- build-system/scripts/build | 6 ++++-- build-system/scripts/ensure_docker_buildx | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build-system/scripts/build b/build-system/scripts/build index e01ce5d8266..b43de10ef07 100755 --- a/build-system/scripts/build +++ b/build-system/scripts/build @@ -66,7 +66,9 @@ echo "Content hash: $CONTENT_HASH" cd $BUILD_DIR ensure_docker_buildx +echo "Creating multi-platform builder" docker buildx create --name multi-platform-builder --bootstrap --use +echo "Multi-platform builder created" # If we have previously successful commit, we can early out if nothing relevant has changed since. if [[ $FORCE_BUILD == 'false' ]] && check_rebuild cache-"$CONTENT_HASH" $REPOSITORY; then @@ -163,7 +165,7 @@ for STAGE in $STAGES; do echo "Building stage: $STAGE" STAGE_IMAGE_COMMIT_URI=$ECR_URL/$REPOSITORY:cache-$CONTENT_HASH-$STAGE # Build our dockerfile, add timing information - docker build --target $STAGE $STAGE_CACHE_FROM -t $STAGE_IMAGE_COMMIT_URI -f $DOCKERFILE --build-arg COMMIT_TAG=$COMMIT_TAG_VERSION --build-arg ARG_CONTENT_HASH=$CONTENT_HASH . \ + #docker build --target $STAGE $STAGE_CACHE_FROM -t $STAGE_IMAGE_COMMIT_URI -f $DOCKERFILE --build-arg COMMIT_TAG=$COMMIT_TAG_VERSION --build-arg ARG_CONTENT_HASH=$CONTENT_HASH . \ docker buildx build --platform linux/amd64,linux/arm64 --target $STAGE $STAGE_CACHE_FROM -t $STAGE_IMAGE_COMMIT_URI -f $DOCKERFILE --build-arg COMMIT_TAG=$COMMIT_TAG_VERSION --build-arg ARG_CONTENT_HASH=$CONTENT_HASH . \ | while read line ; do echo "$(date "+%H:%M:%S")| $line"; done @@ -188,7 +190,7 @@ fi IMAGE_COMMIT_URI=$ECR_URL/$REPOSITORY:cache-$CONTENT_HASH echo "Building image: $IMAGE_COMMIT_URI" # Build our dockerfile, add timing information -docker build -t $IMAGE_COMMIT_URI -f $DOCKERFILE $CACHE_FROM --build-arg COMMIT_TAG=$COMMIT_TAG_VERSION --build-arg ARG_CONTENT_HASH=$CONTENT_HASH . \ +#docker build -t $IMAGE_COMMIT_URI -f $DOCKERFILE $CACHE_FROM --build-arg COMMIT_TAG=$COMMIT_TAG_VERSION --build-arg ARG_CONTENT_HASH=$CONTENT_HASH . \ docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_COMMIT_URI -f $DOCKERFILE $CACHE_FROM --build-arg COMMIT_TAG=$COMMIT_TAG_VERSION --build-arg ARG_CONTENT_HASH=$CONTENT_HASH . \ | while read line ; do echo "$(date "+%H:%M:%S")| $line"; done echo "Pushing image: $IMAGE_COMMIT_URI" diff --git a/build-system/scripts/ensure_docker_buildx b/build-system/scripts/ensure_docker_buildx index c9416cbd00d..5f064e65e05 100755 --- a/build-system/scripts/ensure_docker_buildx +++ b/build-system/scripts/ensure_docker_buildx @@ -1,6 +1,8 @@ #!/bin/bash set -eu +echo "Ensuring we have docker buildx..." + # Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl gnupg @@ -14,4 +16,6 @@ echo \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update -sudo apt-get install docker-buildx-plugin \ No newline at end of file +sudo apt-get install docker-buildx-plugin + +echo "Docker buildx plugin installed!" \ No newline at end of file