adjust build script for docker engine

builder setup is no longer needed
amd64 and arm64 support
This commit is contained in:
t3chn0m4g3 2023-06-29 12:22:19 +02:00
parent 65a443d778
commit 81aad58c2f

View file

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
# Buildx Example: docker buildx build --platform linux/amd64,linux/arm64 -t username/demo:latest --push .
# Setup Vars # Setup Vars
myPLATFORMS="linux/amd64,linux/arm64" myPLATFORMS="linux/amd64,linux/arm64"
myHUBORG="dtagdevsec" myHUBORG="dtagdevsec"
@ -23,9 +25,28 @@ fi
docker buildx > /dev/null 2>&1 docker buildx > /dev/null 2>&1
if [ "$?" == "1" ]; if [ "$?" == "1" ];
then 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 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 # Only run with command switch
if [ "$1" == "" ]; then if [ "$1" == "" ]; then
echo "### T-Pot Multi Arch Image Builder." echo "### T-Pot Multi Arch Image Builder."