photoprism/scripts/docker-build.sh

21 lines
719 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
2021-04-20 06:55:52 +02:00
# see https://docs.docker.com/develop/develop-images/build_enhancements/#to-enable-buildkit-builds
export DOCKER_BUILDKIT=1
if [[ -z $1 ]] && [[ -z $2 ]]; then
echo "Please provide a container image name and version" 1>&2
exit 1
elif [[ $1 ]] && [[ -z $2 ]]; then
DOCKER_TAG=$(date -u +%Y%m%d)
echo "Building 'photoprism/$1:preview'...";
docker build --no-cache --build-arg BUILD_TAG="${DOCKER_TAG}" -t photoprism/$1:preview -f docker/${1/-//}/Dockerfile .
echo "Done"
else
echo "Building 'photoprism/$1:$2'...";
2020-04-28 11:51:42 +02:00
docker build --no-cache --build-arg BUILD_TAG=$2 -t photoprism/$1:latest -t photoprism/$1:$2 -f docker/${1/-//}/Dockerfile .
echo "Done"
fi