2018-11-08 09:56:11 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-08-05 16:17:59 +00:00
|
|
|
set -e
|
2021-08-05 16:06:43 +00:00
|
|
|
|
2021-04-20 04:55:52 +00:00
|
|
|
# see https://docs.docker.com/develop/develop-images/build_enhancements/#to-enable-buildkit-builds
|
|
|
|
export DOCKER_BUILDKIT=1
|
|
|
|
|
2021-12-09 17:48:44 +00:00
|
|
|
GOPROXY=${GOPROXY:-'https://goproxy.io,direct'}
|
|
|
|
|
2020-10-13 20:46:20 +00:00
|
|
|
if [[ -z $1 ]] && [[ -z $2 ]]; then
|
2018-11-08 09:56:11 +00:00
|
|
|
echo "Please provide a container image name and version" 1>&2
|
|
|
|
exit 1
|
2020-10-13 20:46:20 +00:00
|
|
|
elif [[ $1 ]] && [[ -z $2 ]]; then
|
2020-12-26 16:02:15 +00:00
|
|
|
DOCKER_TAG=$(date -u +%Y%m%d)
|
|
|
|
echo "Building 'photoprism/$1:preview'...";
|
2021-12-09 17:48:44 +00:00
|
|
|
docker build \
|
|
|
|
--no-cache \
|
|
|
|
--build-arg BUILD_TAG="${DOCKER_TAG}" \
|
|
|
|
--build-arg GOPROXY \
|
2021-12-10 08:09:21 +00:00
|
|
|
--build-arg GODEBUG \
|
2021-12-09 17:48:44 +00:00
|
|
|
-t photoprism/$1:preview \
|
|
|
|
-f docker/${1/-//}/Dockerfile .
|
2020-10-13 20:46:20 +00:00
|
|
|
echo "Done"
|
2018-11-08 09:56:11 +00:00
|
|
|
else
|
|
|
|
echo "Building 'photoprism/$1:$2'...";
|
2021-12-09 17:48:44 +00:00
|
|
|
docker build \
|
|
|
|
--no-cache \
|
|
|
|
--build-arg BUILD_TAG=$2 \
|
|
|
|
--build-arg GOPROXY \
|
2021-12-10 08:09:21 +00:00
|
|
|
--build-arg GODEBUG \
|
2021-12-09 17:48:44 +00:00
|
|
|
-t photoprism/$1:latest \
|
|
|
|
-t photoprism/$1:$2 \
|
|
|
|
-f docker/${1/-//}/Dockerfile .
|
2018-11-08 09:56:11 +00:00
|
|
|
echo "Done"
|
2019-05-16 06:41:16 +00:00
|
|
|
fi
|