From 54a41e682cac4e46078907b167c7f960a7a1a6b6 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 2 Sep 2022 15:12:57 +0200 Subject: [PATCH] CI: Update develop, preview, and release scripts Signed-off-by: Michael Mayer --- Makefile | 28 ++++++++++++------------ docker/demo/debian/Dockerfile | 37 ++++++++++++++++++++++++++++++++ scripts/codecov.sh | 3 --- scripts/deploy-develop.sh | 6 +++--- scripts/deploy-preview-debian.sh | 16 ++++++++++++++ scripts/deploy-preview-ubuntu.sh | 10 ++++----- scripts/deploy-preview.sh | 12 +++++------ scripts/deploy-release.sh | 8 +++---- 8 files changed, 85 insertions(+), 35 deletions(-) create mode 100644 docker/demo/debian/Dockerfile delete mode 100755 scripts/codecov.sh create mode 100755 scripts/deploy-preview-debian.sh diff --git a/Makefile b/Makefile index 42f936ca6..c166a6ff2 100644 --- a/Makefile +++ b/Makefile @@ -274,10 +274,6 @@ test-verbose: test-race: $(info Running all Go tests with race detection in verbose mode...) $(GOTEST) -tags slow -race -timeout 60m -v ./pkg/... ./internal/... -test-codecov: - $(info Running all Go tests with code coverage report for codecov...) - go test -parallel 1 -count 1 -cpu 1 -failfast -tags slow -timeout 30m -coverprofile coverage.txt -covermode atomic ./pkg/... ./internal/... - scripts/codecov.sh -t $(CODECOV_TOKEN) test-coverage: $(info Running all Go tests with code coverage report...) go test -parallel 1 -count 1 -cpu 1 -failfast -tags slow -timeout 30m -coverprofile coverage.txt -covermode atomic ./pkg/... ./internal/... @@ -291,14 +287,14 @@ docker-pull: docker pull photoprism/photoprism:latest docker-develop: docker-develop-latest docker-develop-all: docker-develop-latest docker-develop-other -docker-develop-latest: docker-develop-debian docker-develop-armv7 +docker-develop-latest: docker-develop-ubuntu docker-develop-armv7 docker-develop-debian: docker-develop-bookworm docker-develop-bookworm-slim docker-develop-ubuntu: docker-develop-jammy docker-develop-jammy-slim docker-develop-other: docker-develop-bullseye docker-develop-bullseye-slim docker-develop-buster docker-develop-jammy docker-develop-bookworm: docker pull --platform=amd64 debian:bookworm-slim docker pull --platform=arm64 debian:bookworm-slim - scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 bookworm /bookworm "-t photoprism/develop:latest -t photoprism/develop:debian" + scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 bookworm /bookworm "-t photoprism/develop:debian" docker-develop-bookworm-slim: docker pull --platform=amd64 debian:bookworm-slim docker pull --platform=arm64 debian:bookworm-slim @@ -325,14 +321,14 @@ docker-develop-impish: docker-develop-jammy: docker pull --platform=amd64 ubuntu:jammy docker pull --platform=arm64 ubuntu:jammy - scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 jammy /jammy "-t photoprism/develop:ubuntu" + scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 jammy /jammy "-t photoprism/develop:latest -t photoprism/develop:ubuntu" docker-develop-jammy-slim: docker pull --platform=amd64 ubuntu:jammy docker pull --platform=arm64 ubuntu:jammy scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 jammy-slim /jammy-slim docker-preview: docker-preview-latest docker-preview-all: docker-preview-latest docker-preview-other -docker-preview-latest: docker-preview-debian +docker-preview-latest: docker-preview-ubuntu docker-preview-debian: docker-preview-bookworm docker-preview-ubuntu: docker-preview-jammy docker-preview-other: docker-preview-bullseye docker-preview-ubuntu @@ -342,7 +338,7 @@ docker-preview-bookworm: docker pull --platform=amd64 photoprism/develop:bookworm-slim docker pull --platform=arm64 photoprism/develop:bookworm docker pull --platform=arm64 photoprism/develop:bookworm-slim - scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview /bookworm "-t photoprism/photoprism:preview-debian" + scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview-bookworm /bookworm "-t photoprism/photoprism:preview-debian" docker-preview-armv7: docker pull --platform=arm photoprism/develop:armv7 docker pull --platform=arm debian:bookworm-slim @@ -368,7 +364,7 @@ docker-preview-jammy: docker pull --platform=amd64 photoprism/develop:jammy-slim docker pull --platform=arm64 photoprism/develop:jammy docker pull --platform=arm64 photoprism/develop:jammy-slim - scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview-jammy /jammy "-t photoprism/photoprism:preview-ubuntu" + scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview /jammy "-t photoprism/photoprism:preview-ubuntu" docker-preview-impish: docker pull --platform=amd64 photoprism/develop:impish docker pull --platform=arm64 photoprism/develop:impish @@ -377,7 +373,7 @@ docker-preview-impish: scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview-impish /impish docker-release: docker-release-latest docker-release-all: docker-release-latest docker-release-other -docker-release-latest: docker-release-debian +docker-release-latest: docker-release-ubuntu docker-release-debian: docker-release-bookworm docker-release-ubuntu: docker-release-jammy docker-release-other: docker-release-bullseye docker-release-ubuntu @@ -387,7 +383,7 @@ docker-release-bookworm: docker pull --platform=amd64 photoprism/develop:bookworm-slim docker pull --platform=arm64 photoprism/develop:bookworm docker pull --platform=arm64 photoprism/develop:bookworm-slim - scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 bookworm /bookworm "-t photoprism/photoprism:latest -t photoprism/photoprism:debian" + scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 bookworm /bookworm "-t photoprism/photoprism:debian" docker-release-armv7: docker pull --platform=arm photoprism/develop:armv7 docker pull --platform=arm debian:bookworm-slim @@ -413,7 +409,7 @@ docker-release-jammy: docker pull --platform=amd64 photoprism/develop:jammy-slim docker pull --platform=arm64 photoprism/develop:jammy docker pull --platform=arm64 photoprism/develop:jammy-slim - scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 jammy /jammy "-t photoprism/photoprism:ubuntu" + scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 jammy /jammy "-t photoprism/photoprism:latest -t photoprism/photoprism:ubuntu" docker-release-impish: docker pull --platform=amd64 photoprism/develop:impish docker pull --platform=arm64 photoprism/develop:impish @@ -467,11 +463,15 @@ docker-goproxy: docker pull golang:alpine scripts/docker/buildx-multi.sh goproxy linux/amd64,linux/arm64 $(BUILD_DATE) docker-demo: docker-demo-latest -docker-demo-all: docker-demo-latest docker-demo-ubuntu +docker-demo-all: docker-demo-latest docker-demo-debian docker-demo-latest: docker pull photoprism/photoprism:preview scripts/docker/build.sh demo $(BUILD_DATE) scripts/docker/push.sh demo $(BUILD_DATE) +docker-demo-debian: + docker pull photoprism/photoprism:preview-debian + scripts/docker/build.sh demo debian /debian + scripts/docker/push.sh demo debian docker-demo-ubuntu: docker pull photoprism/photoprism:preview-ubuntu scripts/docker/build.sh demo ubuntu /ubuntu diff --git a/docker/demo/debian/Dockerfile b/docker/demo/debian/Dockerfile new file mode 100644 index 000000000..b04f4bec1 --- /dev/null +++ b/docker/demo/debian/Dockerfile @@ -0,0 +1,37 @@ +FROM photoprism/photoprism:preview-debian as build + +# Set environment variables +ENV TF_CPP_MIN_LOG_LEVEL=2 \ + PHOTOPRISM_STORAGE_PATH="/photoprism/storage" \ + PHOTOPRISM_DEBUG="false" \ + PHOTOPRISM_READONLY="false" \ + PHOTOPRISM_PUBLIC="true" \ + PHOTOPRISM_DEMO="true" \ + PHOTOPRISM_EXPERIMENTAL="true" \ + PHOTOPRISM_UPLOAD_NSFW="false" \ + PHOTOPRISM_DETECT_NSFW="false" \ + PHOTOPRISM_THUMB_FILTER="lanczos" \ + PHOTOPRISM_THUMB_UNCACHED="true" \ + PHOTOPRISM_THUMB_SIZE=4096 \ + PHOTOPRISM_THUMB_SIZE_UNCACHED=4096 \ + PHOTOPRISM_JPEG_SIZE=4096 \ + PHOTOPRISM_JPEG_QUALITY=85 \ + PHOTOPRISM_APP_NAME="Demo" \ + PHOTOPRISM_APP_ICON="favicon" \ + PHOTOPRISM_SITE_TITLE="PhotoPrism" \ + PHOTOPRISM_SITE_CAPTION="Demo" \ + PHOTOPRISM_SITE_DESCRIPTION="AI-Powered Photos App for the Decentralized Web" + +# Copy assets +COPY /docker/demo/index.tmpl /opt/photoprism/assets/templates + +# Download example photos +RUN wget -qO- https://dl.photoprism.app/qa/demo.tar.gz | tar xvz -C /photoprism/originals + +# Import example photos +RUN photoprism restore -a +RUN photoprism index -a +RUN photoprism moments + +# Start PhotoPrism server +CMD ["photoprism", "--public", "start"] diff --git a/scripts/codecov.sh b/scripts/codecov.sh deleted file mode 100755 index 2ed955d9b..000000000 --- a/scripts/codecov.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -bash <(curl -s https://codecov.io/bash) diff --git a/scripts/deploy-develop.sh b/scripts/deploy-develop.sh index c3bb59515..6c253ed4b 100755 --- a/scripts/deploy-develop.sh +++ b/scripts/deploy-develop.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -# exit on error +# Exit on error. set -ex -# install QEMU for multi-arch builds +# Use QEMU for multi-arch builds. scripts/install-qemu.sh -# build release images +# Build develop images. make docker-develop-all diff --git a/scripts/deploy-preview-debian.sh b/scripts/deploy-preview-debian.sh new file mode 100755 index 000000000..94d583666 --- /dev/null +++ b/scripts/deploy-preview-debian.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# Exit on error. +set -ex + +# Use QEMU for multi-arch builds. +scripts/install-qemu.sh + +# Build preview image. +make docker-preview-debian + +# Wait 2s. +sleep 2 + +# Build debian-based image. +make docker-demo-debian diff --git a/scripts/deploy-preview-ubuntu.sh b/scripts/deploy-preview-ubuntu.sh index 2e9ab84ec..a82fa169d 100755 --- a/scripts/deploy-preview-ubuntu.sh +++ b/scripts/deploy-preview-ubuntu.sh @@ -1,16 +1,16 @@ #!/usr/bin/env bash -# exit on error +# Exit on error. set -ex -# install QEMU for multi-arch builds +# Use QEMU for multi-arch builds. scripts/install-qemu.sh -# build preview image +# Build preview image. make docker-preview-ubuntu -# wait 2s +# Wait 2s. sleep 2 -# build demo image +# Build ubuntu-based image. make docker-demo-ubuntu diff --git a/scripts/deploy-preview.sh b/scripts/deploy-preview.sh index da1c75b40..325605fa6 100755 --- a/scripts/deploy-preview.sh +++ b/scripts/deploy-preview.sh @@ -1,19 +1,19 @@ #!/usr/bin/env bash -# exit on error +# Exit on error. set -ex -# install QEMU for multi-arch builds +# Use QEMU for multi-arch builds. scripts/install-qemu.sh -# run tests +# Run test suite. scripts/test.sh -# build preview image +# Build preview image. make docker-preview -# wait 2s +# Wait 2s. sleep 2 -# build demo image +# Build demo image. make docker-demo diff --git a/scripts/deploy-release.sh b/scripts/deploy-release.sh index c8935aef9..28e22f275 100755 --- a/scripts/deploy-release.sh +++ b/scripts/deploy-release.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash -# exit on error +# Exit on error. set -ex -# install QEMU for multi-arch builds +# Use QEMU for multi-arch builds. scripts/install-qemu.sh -# run tests +# Run test suite. scripts/test.sh -# build release images +# Build release images. make docker-release-all