From 7d09ca55ea8fb8062de066fbae12e249f90fa911 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net>
Date: Mon, 3 Jul 2023 17:31:30 +0200
Subject: [PATCH] --no-cache has become necessary with docker build

---
 scripts/larvatagger.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/larvatagger.sh b/scripts/larvatagger.sh
index f392185..52e624d 100755
--- a/scripts/larvatagger.sh
+++ b/scripts/larvatagger.sh
@@ -22,6 +22,10 @@ for _ in $(seq $#); do
       shift
       ;;
     *)
+      if [ "$1" = "--no-cache" ]; then
+        # --no-cache is default for build since 0.16.1
+        no_cache=1
+      fi
       # note: if DOCKER_ARGS is externally defined, it must end with an explicit space
       DOCKER_ARGS="${DOCKER_ARGS}$1 "
       shift
@@ -78,12 +82,15 @@ DOCKER_ARGS="--build-arg BACKEND=${1:15} $DOCKER_ARGS"; shift
 TARGET=backend
 elif [ "$1" = "--no-cache" ]; then
 echo "Deprecation warning: argument $1 should now be passed before build"
-DOCKER_ARGS="--no-cache $DOCKER_ARGS"; shift
+shift
 else
 echo "argument not supported: $1"; shift
 exit 1
 fi
 done
+if [ -z "$no_cache" ]; then
+  DOCKER_ARGS="--no-cache $DOCKER_ARGS"
+fi
 DOCKER_ARGS="--target $TARGET $DOCKER_ARGS"
 if [ "$BUILD" == "--dev" ]; then
 if ! [[ "$LARVATAGGER_IMAGE" == *:* ]]; then LARVATAGGER_IMAGE="${LARVATAGGER_IMAGE}:dev"; fi
-- 
GitLab