From fb2ca1ab956a41ffb985c0377ae31dcc182dbfaf Mon Sep 17 00:00:00 2001 From: Klaas van Schelven Date: Thu, 3 Oct 2024 13:32:56 +0200 Subject: [PATCH] Add buildxdocker.bash copy/pasta with modifications --- buildxdocker.bash | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 buildxdocker.bash diff --git a/buildxdocker.bash b/buildxdocker.bash new file mode 100755 index 0000000..ccf39ae --- /dev/null +++ b/buildxdocker.bash @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +WHEEL_FILE=$(ls dist/ -1atr | grep bugsink | grep whl | tail -n1) +echo "Building docker image with wheel file: $WHEEL_FILE" + +# example: bugsink-0.1.8.dev5+g200ea5e.d20240827-py3-none-any.whl + +# if this a non-dev version, we tag the image with the full version number, major.minor, major, and latest +# otherwise no tags are added + +if [[ $WHEEL_FILE == *"dev"* ]]; then + echo "This is a dev version, no (numbered) tags will be added, just a :dev tag" + TAGS="-t bugsink/bugsink:dev" +else + VERSION=$(echo $WHEEL_FILE | cut -d'-' -f2) + TAGS="-t bugsink/bugsink:$VERSION -t bugsink/bugsink:$(echo $VERSION | awk -F. '{print $1"."$2}') -t bugsink/bugsink:$(echo $VERSION | awk -F. '{print $1}') -t bugsink/bugsink:latest -t bugsink/bugsink" + echo "This is a non-dev version, tags will be added: $TAGS" +fi + + +docker buildx build --platform linux/amd64,linux/arm64 --build-arg WHEEL_FILE=$WHEEL_FILE $TAGS . --push