From 9861c434f04cf61a3d6e201590f5d77f2de18df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Fri, 26 Jul 2024 18:00:39 +0700 Subject: [PATCH] Update CUDA build script to not tag pre-releases as latest --- docker/build_and_push.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/docker/build_and_push.sh b/docker/build_and_push.sh index 872ef941c1e..20f042f6ba1 100755 --- a/docker/build_and_push.sh +++ b/docker/build_and_push.sh @@ -10,13 +10,19 @@ cd "$(dirname "$0")/.." . versions -livebook_version="$(cat mix.exs | grep '@version "' | grep -v '\-dev' | grep -oE '[0-9]{1,}.[0-9]{1,}.[0-9]{1,}' || true)" +livebook_version="$(cat mix.exs | grep '@version "' | grep -o '".*"' | tr -d '"')" -if [ -z "$livebook_version" ]; then - echo "No stable Livebook version detected" +if [ -z "$livebook_version" ] || [[ "$livebook_version" == *"dev"* ]]; then + echo "No releasable Livebook version detected" exit 1 fi +if [[ "$livebook_version" == *"-"* ]]; then + stable=false +else + stable=true +fi + cuda_tag_list=("cuda11.8" "cuda12.1") cuda_version_list=("11-8" "12-1") @@ -48,10 +54,16 @@ for idx in "${!cuda_tag_list[@]}"; do else echo "Building image: $image" + extra_args="" + + if [[ "$stable" == "true" ]]; then + extra_args="-t ghcr.io/livebook-dev/livebook:latest-$cuda_tag" + fi + docker buildx build --push --platform linux/amd64,linux/arm64 \ --build-arg BASE_IMAGE="$base_image" \ -t $image \ - -t ghcr.io/livebook-dev/livebook:latest-$cuda_tag \ + $extra_args \ . fi done