Docker: Allow additional parameters in build scripts

This commit is contained in:
Michael Mayer 2022-02-16 16:07:05 +01:00
parent 1e0c248cdb
commit c5fb647d96
3 changed files with 37 additions and 7 deletions

View file

@ -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\

View file

@ -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..."

View file

@ -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..."