From 671f0474c14000260fbcb9c572c5c8ef7eca314e Mon Sep 17 00:00:00 2001 From: jay-m-dev Date: Thu, 3 Aug 2023 13:15:22 -0700 Subject: [PATCH 1/2] notes on buildx builder for gen release sh file --- release/generate_production_release.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/release/generate_production_release.sh b/release/generate_production_release.sh index f19ed1b26..e9cf40c0f 100644 --- a/release/generate_production_release.sh +++ b/release/generate_production_release.sh @@ -37,6 +37,20 @@ cp release/docker-compose-hub-image.yml "${PROD_BUILD_DIR}/docker-compose.yml" zip -r $PROD_ZIP_FILENAME $PROD_BUILD_DIR +# build multi-architecture images with buildx +echo "Installing multi-platform installation support" +docker run --privileged -rm tonistiigi/binfmt --install all + +# create an aliro release builder with buildx +docker buildx create --name aliroreleasebuilder --driver docker-container --boostrap --use + +##### NOTES ####### +# Alternatively, I should be able to use the --builder flag, for example docker buildx bake --builder aliroreleasebuilder +# This may be a better option if it works, since this won't change the builder in the current shell. +# The default builder will remain selected, and the aliroreleasebuilder will be used only by this command. +# For completeness, the documentation mentions the BUILDX_BUILDER env variable also: +# https://docs.docker.com/build/builders/ + # build production images echo "Building docker production images" #docker volume prune From 0344f3ca32eba8f7ae0657106fcc1f6a46d77065 Mon Sep 17 00:00:00 2001 From: jay-m-dev Date: Sun, 6 Aug 2023 19:33:38 -0700 Subject: [PATCH 2/2] Release multi-architecture docker hub images the docker-compose-production.yml file was updated with x-bake and docker hub account info. The release shell scripts were updated to use docker buildx bake to build amd64 and arm64 images, and push them to docker hub. --- docker-compose-production.yml | 22 +++++++++++++++++++--- release/deploy_production_release.sh | 11 +++++------ release/generate_production_release.sh | 14 ++++++++------ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/docker-compose-production.yml b/docker-compose-production.yml index 08e473a55..a0044082e 100644 --- a/docker-compose-production.yml +++ b/docker-compose-production.yml @@ -7,7 +7,13 @@ services: context: . dockerfile: docker/lab/Dockerfile target: prod - image: "aliro_lab:${TAG}" + args: + - USE_WHEELS=0 + x-bake: + platforms: + - linux/amd64 + - linux/arm64/v8 + image: "moorelab/aliro_lab:${TAG}" tty: true stdin_open: true volumes: @@ -28,7 +34,13 @@ services: context: . dockerfile: docker/machine/Dockerfile target: prod - image: "aliro_machine:${TAG}" + args: + - USE_WHEELS=0 + x-bake: + platforms: + - linux/amd64 + - linux/arm64/v8 + image: "moorelab/aliro_machine:${TAG}" tty: true stdin_open: true volumes: @@ -47,7 +59,11 @@ services: build: context: . dockerfile: docker/dbmongo/Dockerfile - image: "aliro_dbmongo:${TAG}" + x-bake: + platforms: + - linux/amd64 + - linux/arm64/v8 + image: "moorelab/aliro_dbmongo:${TAG}" tty: true stdin_open: true ports: diff --git a/release/deploy_production_release.sh b/release/deploy_production_release.sh index a16370c8b..67d4182b1 100644 --- a/release/deploy_production_release.sh +++ b/release/deploy_production_release.sh @@ -57,10 +57,11 @@ fi ######################### #### push to dockerhub -echo "Pushing to images to DockerHub" -docker push moorelab/aliro_lab:${TAG} -docker push moorelab/aliro_machine:${TAG} -docker push moorelab/aliro_dbmongo:${TAG} +echo "Images should already be pushed to DockerHub" +# echo "Pushing to images to DockerHub" +# docker push moorelab/aliro_lab:${TAG} +# docker push moorelab/aliro_machine:${TAG} +# docker push moorelab/aliro_dbmongo:${TAG} # git tag git tag -fa "v${TAG}" -m "v${TAG}" @@ -69,5 +70,3 @@ git push --tags # create github relase and attach zip # TODO #echo "Creating Github release and pushing production zip" - - diff --git a/release/generate_production_release.sh b/release/generate_production_release.sh index e9cf40c0f..69756b988 100644 --- a/release/generate_production_release.sh +++ b/release/generate_production_release.sh @@ -54,9 +54,11 @@ docker buildx create --name aliroreleasebuilder --driver docker-container --boos # build production images echo "Building docker production images" #docker volume prune -docker-compose -f docker-compose-production.yml build -m 10g - -echo "Tagging production images" -docker tag aliro_lab:${TAG} moorelab/aliro_lab:${TAG} -docker tag aliro_machine:${TAG} moorelab/aliro_machine:${TAG} -docker tag aliro_dbmongo:${TAG} moorelab/aliro_dbmongo:${TAG} +# docker-compose -f docker-compose-production.yml build -m 10g +docker buildx bake -f docker-compose-production.yml --push + +# tagging production images is not necessary with docker buildx bake +# echo "Tagging production images" +# docker tag aliro_lab:${TAG} moorelab/aliro_lab:${TAG} +# docker tag aliro_machine:${TAG} moorelab/aliro_machine:${TAG} +# docker tag aliro_dbmongo:${TAG} moorelab/aliro_dbmongo:${TAG}