From a612609854787a12ba54a277f08ffdc095989a26 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Thu, 9 May 2019 07:48:41 +0200 Subject: [PATCH] Thumbnail cache warm-up for demo --- docker/demo/Dockerfile | 15 ++++++++++----- docker/photoprism/Dockerfile | 6 +++--- internal/commands/thumbnails.go | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/docker/demo/Dockerfile b/docker/demo/Dockerfile index 77bd0678e..c18575b77 100644 --- a/docker/demo/Dockerfile +++ b/docker/demo/Dockerfile @@ -1,12 +1,17 @@ FROM photoprism/photoprism:latest as build -RUN mkdir -p /srv/photoprism/photos/import && \ - wget -qO- https://dl.photoprism.org/fixtures/demo.tar.gz | tar xvz -C /srv/photoprism/photos/import - -RUN photoprism import - # Hide TensorFlow warnings ENV TF_CPP_MIN_LOG_LEVEL 2 +RUN mkdir -p /srv/photoprism/photos/import && \ + wget -qO- https://dl.photoprism.org/fixtures/demo.tar.gz | tar xvz -C /srv/photoprism/photos/import + +# Import example photos +RUN photoprism import + +# Thumbnail cache warmup +RUN photoprism thumbnails -q -s 50 -s 100 -s 320 -s 500 +RUN photoprism thumbnails -s 720 -s 1280 -s 1920 -s 2560 -s 3840 + # Start PhotoPrism server CMD photoprism start diff --git a/docker/photoprism/Dockerfile b/docker/photoprism/Dockerfile index f70e3357d..66b9f55ac 100644 --- a/docker/photoprism/Dockerfile +++ b/docker/photoprism/Dockerfile @@ -12,6 +12,9 @@ FROM ubuntu:18.04 WORKDIR /srv/photoprism +# Hide TensorFlow warnings +ENV TF_CPP_MIN_LOG_LEVEL 2 + # Install additional distribution packages RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ @@ -45,9 +48,6 @@ RUN apt-get update && \ # Show photoprism version RUN photoprism -v -# Hide TensorFlow warnings -ENV TF_CPP_MIN_LOG_LEVEL 2 - # Expose HTTP & TiDB port EXPOSE 80 EXPOSE 4000 diff --git a/internal/commands/thumbnails.go b/internal/commands/thumbnails.go index 2f0cac311..e356ac401 100644 --- a/internal/commands/thumbnails.go +++ b/internal/commands/thumbnails.go @@ -18,7 +18,7 @@ var ThumbnailsCommand = cli.Command{ }, cli.BoolFlag{ Name: "default, d", - Usage: "Render default sizes: 320, 500, 640, 1280, 1920 and 2560px", + Usage: "Render default sizes: 720, 1280, 1920, 2560 and 3840px", }, cli.BoolFlag{ Name: "square, q", @@ -40,7 +40,7 @@ func thumbnailsAction(ctx *cli.Context) error { sizes := ctx.IntSlice("size") if ctx.Bool("default") { - sizes = []int{320, 500, 640, 1280, 1920, 2560} + sizes = []int{720, 1280, 1920, 2560, 3840} } if len(sizes) == 0 {