diff --git a/.drone.yml b/.drone.yml index 207ff27e9..4e3218098 100644 --- a/.drone.yml +++ b/.drone.yml @@ -23,7 +23,7 @@ steps: CODECOV_TOKEN: from_secret: codecov_token commands: - - scripts/docker-login.sh + - scripts/login.sh - docker-compose -f docker-compose.ci.yml pull - docker-compose -f docker-compose.ci.yml stop - docker-compose -f docker-compose.ci.yml up -d --build --force-recreate @@ -61,7 +61,7 @@ steps: DOCKER_PASSWORD: from_secret: docker_password commands: - - scripts/docker-login.sh + - scripts/login.sh - scripts/install-qemu.sh - make docker-preview when: @@ -77,7 +77,7 @@ steps: DOCKER_PASSWORD: from_secret: docker_password commands: - - scripts/docker-login.sh + - scripts/login.sh - docker pull photoprism/photoprism:preview - make docker-demo when: @@ -93,7 +93,7 @@ steps: DOCKER_PASSWORD: from_secret: docker_password commands: - - scripts/docker-login.sh + - scripts/login.sh - scripts/install-qemu.sh - make docker-release when: @@ -158,7 +158,7 @@ steps: DOCKER_PASSWORD: from_secret: docker_password commands: - - scripts/docker-login.sh + - scripts/login.sh - docker-compose -f docker-compose.ci.yml stop - docker-compose -f docker-compose.ci.yml up -d --build --force-recreate diff --git a/Makefile b/Makefile index c92341fd7..278037afc 100644 --- a/Makefile +++ b/Makefile @@ -205,37 +205,37 @@ clean: docker-development: docker pull --platform=amd64 ubuntu:21.10 docker pull --platform=arm64 ubuntu:21.10 - scripts/docker-buildx.sh development linux/amd64,linux/arm64 $(DOCKER_TAG) + scripts/docker/multarch.sh development linux/amd64,linux/arm64 $(DOCKER_TAG) docker-preview: - scripts/docker-buildx.sh photoprism linux/amd64,linux/arm64 + scripts/docker/multarch.sh photoprism linux/amd64,linux/arm64 docker-release: - scripts/docker-buildx.sh photoprism linux/amd64,linux/arm64 $(DOCKER_TAG) + scripts/docker/multarch.sh photoprism linux/amd64,linux/arm64 $(DOCKER_TAG) docker-armv7-preview: - scripts/docker-buildx.sh photoprism linux/arm armv7-preview /armv7 + scripts/docker/multarch.sh photoprism linux/arm armv7-preview /armv7 docker-armv7-release: - scripts/docker-buildx.sh photoprism linux/arm armv7 /armv7 + scripts/docker/multarch.sh photoprism linux/arm armv7 /armv7 docker-local: - scripts/docker-build.sh photoprism + scripts/docker/build.sh photoprism docker-pull: docker pull photoprism/photoprism:preview photoprism/photoprism:latest docker-goproxy: docker pull golang:alpine - scripts/docker-buildx.sh goproxy linux/amd64,linux/arm64 $(DOCKER_TAG) + scripts/docker/multarch.sh goproxy linux/amd64,linux/arm64 $(DOCKER_TAG) docker-demo: - scripts/docker-build.sh demo $(DOCKER_TAG) - scripts/docker-push.sh demo $(DOCKER_TAG) + scripts/docker/build.sh demo $(DOCKER_TAG) + scripts/docker/push.sh demo $(DOCKER_TAG) docker-demo-local: - scripts/docker-build.sh photoprism - scripts/docker-build.sh demo $(DOCKER_TAG) - scripts/docker-push.sh demo $(DOCKER_TAG) + scripts/docker/build.sh photoprism + scripts/docker/build.sh demo $(DOCKER_TAG) + scripts/docker/push.sh demo $(DOCKER_TAG) docker-dummy-webdav: docker pull --platform=amd64 golang:1 docker pull --platform=arm64 golang:1 - scripts/docker-buildx.sh dummy-webdav linux/amd64,linux/arm64 $(DOCKER_TAG) + scripts/docker/multarch.sh dummy-webdav linux/amd64,linux/arm64 $(DOCKER_TAG) docker-dummy-oidc: docker pull --platform=amd64 golang:1 docker pull --platform=arm64 golang:1 - scripts/docker-buildx.sh dummy-oidc linux/amd64,linux/arm64 $(DOCKER_TAG) + scripts/docker/multarch.sh dummy-oidc linux/amd64,linux/arm64 $(DOCKER_TAG) packer-digitalocean: $(info Buildinng DigitalOcean marketplace image...) (cd ./docker/examples/cloud && packer build digitalocean.json) diff --git a/scripts/docker-build.sh b/scripts/docker/build.sh similarity index 98% rename from scripts/docker-build.sh rename to scripts/docker/build.sh index 80090c471..762e4fba7 100755 --- a/scripts/docker-build.sh +++ b/scripts/docker/build.sh @@ -38,7 +38,7 @@ elif [[ $2 =~ $NUMERIC ]]; then else echo "Building 'photoprism/$1:$2' in docker/${1/-//}$3/Dockerfile..."; DOCKER_TAG=$(date -u +%Y%m%d) - docker build \ + docker build $4\ --no-cache \ --pull \ --build-arg BUILD_TAG=$DOCKER_TAG \ diff --git a/scripts/docker-login.sh b/scripts/docker/login.sh similarity index 100% rename from scripts/docker-login.sh rename to scripts/docker/login.sh diff --git a/scripts/docker-buildx.sh b/scripts/docker/multiarch.sh similarity index 100% rename from scripts/docker-buildx.sh rename to scripts/docker/multiarch.sh diff --git a/scripts/docker-push.sh b/scripts/docker/push.sh similarity index 77% rename from scripts/docker-push.sh rename to scripts/docker/push.sh index d6aee27ab..edcf48b49 100755 --- a/scripts/docker-push.sh +++ b/scripts/docker/push.sh @@ -6,6 +6,8 @@ if [[ -z $DOCKER_PASSWORD ]] || [[ -z $DOCKER_USERNAME ]]; then docker login fi +NUMERIC='^[0-9]+$' + if [[ -z $1 ]] && [[ -z $2 ]]; then echo "Please provide a container image name and version" 1>&2 exit 1 @@ -13,9 +15,13 @@ elif [[ $1 ]] && [[ -z $2 ]]; then echo "Pushing 'photoprism/$1:preview' to Docker hub..."; docker push photoprism/$1:preview echo "Done" -else +elif [[ $2 =~ $NUMERIC ]]; then echo "Pushing 'photoprism/$1:$2' to Docker hub..."; docker push photoprism/$1:latest docker push photoprism/$1:$2 echo "Done" +else + echo "Pushing 'photoprism/$1:$2' to Docker hub..."; + docker push photoprism/$1:$2 + echo "Done" fi diff --git a/scripts/test.sh b/scripts/test.sh index 0cd7d1d9d..787e79cb7 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -3,7 +3,7 @@ set -e # Login -scripts/docker-login.sh +scripts/docker/login.sh # Run tests docker-compose -f docker-compose.ci.yml pull