From c5fb647d96458df93ecb6dfde3278af4bdb3d8cf Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 16 Feb 2022 16:07:05 +0100 Subject: [PATCH] Docker: Allow additional parameters in build scripts --- scripts/docker/build.sh | 16 +++++++++++++--- scripts/docker/buildx-multi.sh | 14 ++++++++++++-- scripts/docker/buildx.sh | 14 ++++++++++++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/scripts/docker/build.sh b/scripts/docker/build.sh index 5dff7860e..f8826d3b6 100755 --- a/scripts/docker/build.sh +++ b/scripts/docker/build.sh @@ -26,7 +26,12 @@ if [[ $1 ]] && [[ -z $2 || $2 == "preview" ]]; then -f docker/${1/-//}$3/Dockerfile . elif [[ $2 =~ $NUMERIC ]]; then echo "docker/build: building photoprism/$1:$2,$1:latest from docker/${1/-//}$3/Dockerfile..."; - docker build \ + + if [[ $4 ]]; then + echo "extra params: $4" + fi + + docker build $4\ --no-cache \ --pull \ --build-arg BUILD_TAG=$2 \ @@ -37,6 +42,11 @@ elif [[ $2 =~ $NUMERIC ]]; then -f docker/${1/-//}$3/Dockerfile . elif [[ $2 == *"preview"* ]]; then echo "docker/build: building photoprism/$1:$2 from docker/${1/-//}$3/Dockerfile..."; + + if [[ $4 ]]; then + echo "extra params: $4" + fi + docker build $4\ --no-cache \ --pull \ @@ -48,8 +58,8 @@ elif [[ $2 == *"preview"* ]]; then else echo "docker/build: building photoprism/$1:$2,$1:$DOCKER_TAG-$2 from docker/${1/-//}$3/Dockerfile..."; - if [[ $5 ]]; then - echo "extra params: $5" + if [[ $4 ]]; then + echo "extra params: $4" fi docker build $4\ diff --git a/scripts/docker/buildx-multi.sh b/scripts/docker/buildx-multi.sh index e97677abe..01cf7642d 100755 --- a/scripts/docker/buildx-multi.sh +++ b/scripts/docker/buildx-multi.sh @@ -36,6 +36,11 @@ if [[ $1 ]] && [[ $2 ]] && [[ -z $3 || $3 == "preview" ]]; then --push . elif [[ $3 =~ $NUMERIC ]]; then echo "docker/buildx-multi: building photoprism/$1:$3,$1:latest from docker/${1/-//}$4/Dockerfile..." + + if [[ $5 ]]; then + echo "extra params: $5" + fi + docker buildx build \ --platform $2 \ --pull \ @@ -45,10 +50,15 @@ elif [[ $3 =~ $NUMERIC ]]; then --build-arg GODEBUG \ -f docker/${1/-//}$4/Dockerfile \ -t photoprism/$1:latest \ - -t photoprism/$1:$3 \ + -t photoprism/$1:$3 $5 \ --push . elif [[ $4 ]] && [[ $3 == *"preview"* ]]; then echo "docker/buildx-multi: building photoprism/$1:$3 from docker/${1/-//}$4/Dockerfile..." + + if [[ $5 ]]; then + echo "extra params: $5" + fi + docker buildx build \ --platform $2 \ --pull \ @@ -57,7 +67,7 @@ elif [[ $4 ]] && [[ $3 == *"preview"* ]]; then --build-arg GOPROXY \ --build-arg GODEBUG \ -f docker/${1/-//}$4/Dockerfile \ - -t photoprism/$1:$3 \ + -t photoprism/$1:$3 $5 \ --push . elif [[ $4 ]]; then echo "docker/buildx-multi: building photoprism/$1:$3,$1:$DOCKER_TAG-$3 from docker/${1/-//}$4/Dockerfile..." diff --git a/scripts/docker/buildx.sh b/scripts/docker/buildx.sh index 4faa1a6e5..84ba9d3fb 100755 --- a/scripts/docker/buildx.sh +++ b/scripts/docker/buildx.sh @@ -26,6 +26,11 @@ if [[ $1 ]] && [[ $2 ]] && [[ -z $3 || $3 == "preview" ]]; then --push . elif [[ $3 =~ $NUMERIC ]]; then echo "docker/buildx: building photoprism/$1:$3,$1:latest from docker/${1/-//}$4/Dockerfile..." + + if [[ $5 ]]; then + echo "extra params: $5" + fi + docker buildx build \ --platform $2 \ --pull \ @@ -35,10 +40,15 @@ elif [[ $3 =~ $NUMERIC ]]; then --build-arg GODEBUG \ -f docker/${1/-//}$4/Dockerfile \ -t photoprism/$1:latest \ - -t photoprism/$1:$3 \ + -t photoprism/$1:$3 $5 \ --push . elif [[ $4 ]] && [[ $3 == *"preview"* ]]; then echo "docker/buildx: building photoprism/$1:$3 from docker/${1/-//}$4/Dockerfile..." + + if [[ $5 ]]; then + echo "extra params: $5" + fi + docker buildx build \ --platform $2 \ --pull \ @@ -47,7 +57,7 @@ elif [[ $4 ]] && [[ $3 == *"preview"* ]]; then --build-arg GOPROXY \ --build-arg GODEBUG \ -f docker/${1/-//}$4/Dockerfile \ - -t photoprism/$1:$3 \ + -t photoprism/$1:$3 $5 \ --push . else echo "docker/buildx: building photoprism/$1:$3,$1:$DOCKER_TAG-$3 from docker/${1/-//}$4/Dockerfile..."