Docker: Reorganize image folders and update build scripts

This commit is contained in:
Michael Mayer 2022-02-16 14:29:42 +01:00
parent 0a696f8d49
commit 823f864896
9 changed files with 52 additions and 52 deletions

View file

@ -202,43 +202,43 @@ clean:
rm -rf storage/backup rm -rf storage/backup
rm -rf storage/cache rm -rf storage/cache
rm -rf frontend/node_modules rm -rf frontend/node_modules
docker-develop: docker-develop-impish docker-develop-buster docker-develop-bullseye docker-develop: docker-develop-impish docker-develop-bullseye docker-develop-buster docker-develop-armv7
docker-develop-impish: docker-develop-impish:
docker pull --platform=amd64 ubuntu:21.10 docker pull --platform=amd64 ubuntu:impish
docker pull --platform=arm64 ubuntu:21.10 docker pull --platform=arm64 ubuntu:impish
scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 $(DOCKER_TAG) scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 $(DOCKER_TAG) /impish
docker-develop-buster:
docker pull --platform=amd64 golang:buster
docker pull --platform=arm64 golang:buster
scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 buster /buster
docker-develop-bullseye: docker-develop-bullseye:
docker pull --platform=amd64 golang:bullseye docker pull --platform=amd64 golang:bullseye
docker pull --platform=arm64 golang:bullseye docker pull --platform=arm64 golang:bullseye
scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 bullseye /bullseye scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 bullseye /bullseye
docker-preview: docker-preview-impish docker-preview-buster docker-preview-bullseye docker-develop-buster:
docker-preview-impish: docker pull --platform=amd64 golang:buster
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 docker pull --platform=arm64 golang:buster
docker-preview-buster: scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 buster /buster
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview-buster /buster
docker-preview-bullseye:
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview-bullseye /bullseye
docker-release: docker-release-impish docker-release-buster docker-release-bullseye
docker-release-impish:
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 $(DOCKER_TAG)
docker-release-buster:
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 buster /buster
docker-release-bullseye:
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 bullseye /bullseye
docker-preview-arm64:
scripts/docker/buildx.sh photoprism linux/arm64 preview-arm64 /bullseye
docker-release-arm64:
scripts/docker/buildx.sh photoprism linux/arm64 arm64 /bullseye
docker-develop-armv7: docker-develop-armv7:
docker pull --platform=arm golang:bullseye docker pull --platform=arm golang:bullseye
scripts/docker/buildx.sh develop linux/arm armv7 /armv7 scripts/docker/buildx.sh develop linux/arm armv7 /armv7
docker-preview: docker-preview-impish docker-preview-bullseye docker-preview-buster
docker-preview-impish:
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview /impish
docker-preview-bullseye:
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview-bullseye /bullseye
docker-preview-buster:
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview-buster /buster
docker-preview-arm64:
scripts/docker/buildx.sh photoprism linux/arm64 preview-arm64 /bullseye
docker-preview-armv7: docker-preview-armv7:
docker pull --platform=arm photoprism/develop:armv7 docker pull --platform=arm photoprism/develop:armv7
scripts/docker/buildx.sh photoprism linux/arm preview-armv7 /armv7 scripts/docker/buildx.sh photoprism linux/arm preview-armv7 /armv7
docker-release: docker-release-impish docker-release-bullseye docker-release-buster
docker-release-impish:
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 $(DOCKER_TAG) /impish
docker-release-bullseye:
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 bullseye /bullseye
docker-release-buster:
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 buster /buster
docker-release-arm64:
scripts/docker/buildx.sh photoprism linux/arm64 arm64 /bullseye
docker-release-armv7: docker-release-armv7:
docker pull --platform=arm photoprism/develop:armv7 docker pull --platform=arm photoprism/develop:armv7
scripts/docker/buildx.sh photoprism linux/arm armv7 /armv7 scripts/docker/buildx.sh photoprism linux/arm armv7 /armv7

View file

@ -19,8 +19,8 @@ systems and devices, which saves our team a lot of time that we can then spend [
providing support and developing one of the many features that users are waiting for. providing support and developing one of the many features that users are waiting for.
Human-readable and versioned Dockerfiles as part of our public source code also help avoid "works for me" moments and Human-readable and versioned Dockerfiles as part of our public source code also help avoid "works for me" moments and
other unwelcome surprises by enabling us to have the exact same environment everywhere in [development](develop/Dockerfile) other unwelcome surprises by enabling us to have the exact same environment everywhere in [development](develop/impish/Dockerfile)
and [production](photoprism/Dockerfile). and [production](photoprism/impish/Dockerfile).
Last but not least, virtually all file format parsers have vulnerabilities that just haven't been discovered yet. Last but not least, virtually all file format parsers have vulnerabilities that just haven't been discovered yet.
This is a known risk that can affect you even if your computer is not directly connected to the Internet. This is a known risk that can affect you even if your computer is not directly connected to the Internet.

View file

@ -1,4 +1,4 @@
FROM ubuntu:21.10 FROM ubuntu:impish
LABEL maintainer="Michael Mayer <hello@photoprism.app>" LABEL maintainer="Michael Mayer <hello@photoprism.app>"

View file

@ -1,5 +1,5 @@
##################################################### BUILD STAGE ###################################################### ##################################################### BUILD STAGE ######################################################
FROM photoprism/develop:20220215-bullseye as build FROM photoprism/develop:20220216-bullseye as build
ARG TARGETARCH ARG TARGETARCH
ARG TARGETPLATFORM ARG TARGETPLATFORM

View file

@ -1,5 +1,5 @@
##################################################### BUILD STAGE ###################################################### ##################################################### BUILD STAGE ######################################################
FROM photoprism/develop:20220215-buster as build FROM photoprism/develop:20220216-buster as build
ARG TARGETARCH ARG TARGETARCH
ARG TARGETPLATFORM ARG TARGETPLATFORM

View file

@ -1,5 +1,5 @@
##################################################### BUILD STAGE ###################################################### ##################################################### BUILD STAGE ######################################################
FROM photoprism/develop:20220215 as build FROM photoprism/develop:20220216 as build
ARG TARGETARCH ARG TARGETARCH
ARG TARGETPLATFORM ARG TARGETPLATFORM
@ -9,13 +9,13 @@ ARG GODEBUG
# set up project directory # set up project directory
WORKDIR "/go/src/github.com/photoprism/photoprism" WORKDIR "/go/src/github.com/photoprism/photoprism"
COPY . . COPY .. .
# build frontend and backend # build frontend and backend
RUN make npm dep build-js install RUN make npm dep build-js install
################################################## PRODUCTION STAGE #################################################### ################################################## PRODUCTION STAGE ####################################################
FROM ubuntu:21.10 FROM ubuntu:impish
LABEL maintainer="Michael Mayer <hello@photoprism.app>" LABEL maintainer="Michael Mayer <hello@photoprism.app>"

View file

@ -14,8 +14,8 @@ NUMERIC='^[0-9]+$'
GOPROXY=${GOPROXY:-'https://proxy.golang.org,direct'} GOPROXY=${GOPROXY:-'https://proxy.golang.org,direct'}
DOCKER_TAG=$(date -u +%Y%m%d) DOCKER_TAG=$(date -u +%Y%m%d)
if [[ $1 ]] && [[ -z $2 ]]; then if [[ $1 ]] && [[ -z $2 || $2 == "preview" ]]; then
echo "docker/build: building photoprism/$1:preview..."; echo "docker/build: building photoprism/$1:preview from docker/${1/-//}$3/Dockerfile...";
docker build \ docker build \
--no-cache \ --no-cache \
--pull \ --pull \
@ -23,9 +23,9 @@ if [[ $1 ]] && [[ -z $2 ]]; then
--build-arg GOPROXY \ --build-arg GOPROXY \
--build-arg GODEBUG \ --build-arg GODEBUG \
-t photoprism/$1:preview \ -t photoprism/$1:preview \
-f docker/${1/-//}/Dockerfile . -f docker/${1/-//}$3/Dockerfile .
elif [[ $2 =~ $NUMERIC ]]; then elif [[ $2 =~ $NUMERIC ]]; then
echo "docker/build: building photoprism/$1:$2,$1:latest..."; echo "docker/build: building photoprism/$1:$2,$1:latest from docker/${1/-//}$3/Dockerfile...";
docker build \ docker build \
--no-cache \ --no-cache \
--pull \ --pull \
@ -34,7 +34,7 @@ elif [[ $2 =~ $NUMERIC ]]; then
--build-arg GODEBUG \ --build-arg GODEBUG \
-t photoprism/$1:latest \ -t photoprism/$1:latest \
-t photoprism/$1:$2 \ -t photoprism/$1:$2 \
-f docker/${1/-//}/Dockerfile . -f docker/${1/-//}$3/Dockerfile .
elif [[ $2 == *"preview"* ]]; then elif [[ $2 == *"preview"* ]]; then
echo "docker/build: building photoprism/$1:$2 from docker/${1/-//}$3/Dockerfile..."; echo "docker/build: building photoprism/$1:$2 from docker/${1/-//}$3/Dockerfile...";
docker build $4\ docker build $4\

View file

@ -12,18 +12,18 @@ NUMERIC='^[0-9]+$'
GOPROXY=${GOPROXY:-'https://proxy.golang.org,direct'} GOPROXY=${GOPROXY:-'https://proxy.golang.org,direct'}
DOCKER_TAG=$(date -u +%Y%m%d) DOCKER_TAG=$(date -u +%Y%m%d)
# Kill old multibuilder if still alive. # kill old multi builder if still alive.
echo "docker/buildx-multi: removing existing multibuilder..." echo "docker/buildx-multi: removing existing multibuilder..."
docker buildx rm multibuilder 2>/dev/null docker buildx rm multibuilder 2>/dev/null
# Wait 5 seconds. # wait 5 seconds.
sleep 5 sleep 5
# Create new multibuilder. # create new multibuilder.
docker buildx create --name multibuilder --use || { echo 'failed'; exit 1; } docker buildx create --name multibuilder --use || { echo 'failed'; exit 1; }
if [[ $1 ]] && [[ $2 ]] && [[ -z $3 ]]; then if [[ $1 ]] && [[ $2 ]] && [[ -z $3 || $3 == "preview" ]]; then
echo "docker/buildx-multi: building photoprism/$1:preview..." echo "docker/buildx-multi: building photoprism/$1:preview from docker/${1/-//}$4/Dockerfile..."
docker buildx build \ docker buildx build \
--platform $2 \ --platform $2 \
--pull \ --pull \
@ -31,11 +31,11 @@ if [[ $1 ]] && [[ $2 ]] && [[ -z $3 ]]; then
--build-arg BUILD_TAG=$DOCKER_TAG \ --build-arg BUILD_TAG=$DOCKER_TAG \
--build-arg GOPROXY \ --build-arg GOPROXY \
--build-arg GODEBUG \ --build-arg GODEBUG \
-f docker/${1/-//}/Dockerfile \ -f docker/${1/-//}$4/Dockerfile \
-t photoprism/$1:preview \ -t photoprism/$1:preview \
--push . --push .
elif [[ $3 =~ $NUMERIC ]]; then elif [[ $3 =~ $NUMERIC ]]; then
echo "docker/buildx-multi: building photoprism/$1:$3,$1:latest..." echo "docker/buildx-multi: building photoprism/$1:$3,$1:latest from docker/${1/-//}$4/Dockerfile..."
docker buildx build \ docker buildx build \
--platform $2 \ --platform $2 \
--pull \ --pull \
@ -43,7 +43,7 @@ elif [[ $3 =~ $NUMERIC ]]; then
--build-arg BUILD_TAG=$3 \ --build-arg BUILD_TAG=$3 \
--build-arg GOPROXY \ --build-arg GOPROXY \
--build-arg GODEBUG \ --build-arg GODEBUG \
-f docker/${1/-//}/Dockerfile \ -f docker/${1/-//}$4/Dockerfile \
-t photoprism/$1:latest \ -t photoprism/$1:latest \
-t photoprism/$1:$3 \ -t photoprism/$1:$3 \
--push . --push .

View file

@ -12,8 +12,8 @@ NUMERIC='^[0-9]+$'
GOPROXY=${GOPROXY:-'https://proxy.golang.org,direct'} GOPROXY=${GOPROXY:-'https://proxy.golang.org,direct'}
DOCKER_TAG=$(date -u +%Y%m%d) DOCKER_TAG=$(date -u +%Y%m%d)
if [[ $1 ]] && [[ $2 ]] && [[ -z $3 ]]; then if [[ $1 ]] && [[ $2 ]] && [[ -z $3 || $3 == "preview" ]]; then
echo "docker/buildx: building photoprism/$1:preview..." echo "docker/buildx: building photoprism/$1:preview from docker/${1/-//}$4/Dockerfile..."
docker buildx build \ docker buildx build \
--platform $2 \ --platform $2 \
--pull \ --pull \
@ -21,11 +21,11 @@ if [[ $1 ]] && [[ $2 ]] && [[ -z $3 ]]; then
--build-arg BUILD_TAG=$DOCKER_TAG \ --build-arg BUILD_TAG=$DOCKER_TAG \
--build-arg GOPROXY \ --build-arg GOPROXY \
--build-arg GODEBUG \ --build-arg GODEBUG \
-f docker/${1/-//}/Dockerfile \ -f docker/${1/-//}$4/Dockerfile \
-t photoprism/$1:preview \ -t photoprism/$1:preview \
--push . --push .
elif [[ $3 =~ $NUMERIC ]]; then elif [[ $3 =~ $NUMERIC ]]; then
echo "docker/buildx: building photoprism/$1:$3,$1:latest..." echo "docker/buildx: building photoprism/$1:$3,$1:latest from docker/${1/-//}$4/Dockerfile..."
docker buildx build \ docker buildx build \
--platform $2 \ --platform $2 \
--pull \ --pull \
@ -33,7 +33,7 @@ elif [[ $3 =~ $NUMERIC ]]; then
--build-arg BUILD_TAG=$3 \ --build-arg BUILD_TAG=$3 \
--build-arg GOPROXY \ --build-arg GOPROXY \
--build-arg GODEBUG \ --build-arg GODEBUG \
-f docker/${1/-//}/Dockerfile \ -f docker/${1/-//}$4/Dockerfile \
-t photoprism/$1:latest \ -t photoprism/$1:latest \
-t photoprism/$1:$3 \ -t photoprism/$1:$3 \
--push . --push .