From 81aad58c2f0a657c6c419b03dc7e97d4cecd2e13 Mon Sep 17 00:00:00 2001 From: t3chn0m4g3 Date: Thu, 29 Jun 2023 12:22:19 +0200 Subject: [PATCH] adjust build script for docker engine builder setup is no longer needed amd64 and arm64 support --- docker/builder.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docker/builder.sh b/docker/builder.sh index 9e36af74..85963f8c 100755 --- a/docker/builder.sh +++ b/docker/builder.sh @@ -1,5 +1,7 @@ #!/bin/bash +# Buildx Example: docker buildx build --platform linux/amd64,linux/arm64 -t username/demo:latest --push . + # Setup Vars myPLATFORMS="linux/amd64,linux/arm64" myHUBORG="dtagdevsec" @@ -23,9 +25,28 @@ fi docker buildx > /dev/null 2>&1 if [ "$?" == "1" ]; then - echo "### Build environment not setup. Run bin/setup_builder.sh" + echo "### Build environment not setup. Install docker engine from docker:" + echo "### https://docs.docker.com/engine/install/debian/" fi +# Let's ensure arm64 and amd64 are supported +echo "### Let's ensure ARM64 and AMD64 are supported ..." +myARCHITECTURES="amd64 arm64" +mySUPPORTED=$(docker buildx inspect --bootstrap) + +for i in $myARCHITECTURES; + do + if ! echo $mySUPPORTED | grep -q linux/$i; + then + echo "## Installing $i support ..." + docker run --privileged --rm tonistiigi/binfmt --install $i + docker buildx inspect --bootstrap + else + echo "## $i support detected!" + fi + done +echo + # Only run with command switch if [ "$1" == "" ]; then echo "### T-Pot Multi Arch Image Builder."