Docker: Install optional dependencies via PHOTOPRISM_INIT #536 #1337

This commit is contained in:
Michael Mayer 2021-09-29 09:01:57 +02:00
parent 6272530b39
commit 09d2673099
18 changed files with 142 additions and 50 deletions

View file

@ -2,6 +2,7 @@ FROM photoprism/development:20210928
# Copy latest entrypoint script
COPY --chown=root:root /docker/development/entrypoint.sh /entrypoint.sh
COPY --chown=root:root /docker/scripts/Makefile /root/Makefile
# Set up project directory
WORKDIR "/go/src/github.com/photoprism/photoprism"

View file

@ -40,6 +40,7 @@ services:
PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage"
PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals"
PHOTOPRISM_IMPORT_PATH: "/go/src/github.com/photoprism/photoprism/storage/import"
PHOTOPRISM_DISABLE_CHOWN: "true" # Disables storage permission updates on startup
PHOTOPRISM_DISABLE_BACKUPS: "false" # Don't backup photo and album metadata to YAML files
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI

View file

@ -31,6 +31,7 @@ services:
PHOTOPRISM_DATABASE_USER: "root"
PHOTOPRISM_DATABASE_PASSWORD: "photoprism"
PHOTOPRISM_ADMIN_PASSWORD: "photoprism" # The initial admin password (min 4 characters)
PHOTOPRISM_DISABLE_CHOWN: "false" # Disables storage permission updates on startup
PHOTOPRISM_DISABLE_BACKUPS: "false" # Don't backup photo and album metadata to YAML files
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI

View file

@ -13,10 +13,6 @@ services:
ports:
- "2342:2342" # Web Server (PhotoPrism)
- "2343:2343" # Acceptance Tests
working_dir: "/go/src/github.com/photoprism/photoprism"
volumes:
- ".:/go/src/github.com/photoprism/photoprism"
- "go-mod:/go/pkg/mod"
shm_size: "2gb"
environment:
PHOTOPRISM_UID: ${UID:-1000}
@ -33,7 +29,7 @@ services:
PHOTOPRISM_SERVER_MODE: "debug"
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
PHOTOPRISM_HTTP_PORT: 2342
PHOTOPRISM_HTTP_COMPRESSION: "gzip" # Improves transfer speed and bandwidth utilization (none or gzip)
PHOTOPRISM_HTTP_COMPRESSION: "gzip" # Improves transfer speed and bandwidth utilization (none or gzip)
PHOTOPRISM_DATABASE_DRIVER: "mysql"
PHOTOPRISM_DATABASE_SERVER: "mariadb:4001"
PHOTOPRISM_DATABASE_NAME: "photoprism"
@ -41,28 +37,44 @@ services:
PHOTOPRISM_DATABASE_PASSWORD: "photoprism"
PHOTOPRISM_TEST_DRIVER: "sqlite"
PHOTOPRISM_TEST_DSN: ".test.db"
PHOTOPRISM_ADMIN_PASSWORD: "photoprism" # The initial admin password (min 4 characters)
PHOTOPRISM_ADMIN_PASSWORD: "photoprism" # The initial admin password (min 4 characters)
PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets"
PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage"
PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals"
PHOTOPRISM_IMPORT_PATH: "/go/src/github.com/photoprism/photoprism/storage/import"
PHOTOPRISM_DISABLE_BACKUPS: "false" # Don't backup photo and album metadata to YAML files
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI
PHOTOPRISM_DISABLE_PLACES: "false" # Disables reverse geocoding and maps
PHOTOPRISM_DISABLE_EXIFTOOL: "false" # Don't create ExifTool JSON files for improved metadata extraction
PHOTOPRISM_DISABLE_TENSORFLOW: "false" # Don't use TensorFlow for image classification
PHOTOPRISM_DETECT_NSFW: "false" # Flag photos as private that MAY be offensive (requires TensorFlow)
PHOTOPRISM_UPLOAD_NSFW: "false" # Allows uploads that may be offensive
PHOTOPRISM_DARKTABLE_PRESETS: "false" # Enables Darktable presets and disables concurrent RAW conversion
PHOTOPRISM_THUMB_FILTER: "lanczos" # Resample filter, best to worst: blackman, lanczos, cubic, linear
PHOTOPRISM_THUMB_UNCACHED: "true" # Enables on-demand thumbnail rendering (high memory and cpu usage)
PHOTOPRISM_THUMB_SIZE: 2048 # Pre-rendered thumbnail size limit (default 2048, min 720, max 7680)
# PHOTOPRISM_THUMB_SIZE: 4096 # Retina 4K, DCI 4K (requires more storage); 7680 for 8K Ultra HD
PHOTOPRISM_THUMB_SIZE_UNCACHED: 7680 # On-demand rendering size limit (default 7680, min 720, max 7680)
PHOTOPRISM_JPEG_SIZE: 7680 # Size limit for converted image files in pixels (720-30000)
PHOTOPRISM_JPEG_QUALITY: 92 # Set to 95 for high-quality thumbnails (25-100)
TF_CPP_MIN_LOG_LEVEL: 0 # Show TensorFlow log messages for development
PHOTOPRISM_DISABLE_CHOWN: "false" # Disables storage permission updates on startup
PHOTOPRISM_DISABLE_BACKUPS: "false" # Don't backup photo and album metadata to YAML files
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI
PHOTOPRISM_DISABLE_PLACES: "false" # Disables reverse geocoding and maps
PHOTOPRISM_DISABLE_EXIFTOOL: "false" # Don't create ExifTool JSON files for improved metadata extraction
PHOTOPRISM_DISABLE_TENSORFLOW: "false" # Don't use TensorFlow for image classification
PHOTOPRISM_DETECT_NSFW: "false" # Flag photos as private that MAY be offensive (requires TensorFlow)
PHOTOPRISM_UPLOAD_NSFW: "false" # Allows uploads that may be offensive
PHOTOPRISM_DARKTABLE_PRESETS: "false" # Enables Darktable presets and disables concurrent RAW conversion
PHOTOPRISM_THUMB_FILTER: "lanczos" # Resample filter, best to worst: blackman, lanczos, cubic, linear
PHOTOPRISM_THUMB_UNCACHED: "true" # Enables on-demand thumbnail rendering (high memory and cpu usage)
PHOTOPRISM_THUMB_SIZE: 2048 # Pre-rendered thumbnail size limit (default 2048, min 720, max 7680)
# PHOTOPRISM_THUMB_SIZE: 4096 # Retina 4K, DCI 4K (requires more storage); 7680 for 8K Ultra HD
PHOTOPRISM_THUMB_SIZE_UNCACHED: 7680 # On-demand rendering size limit (default 7680, min 720, max 7680)
PHOTOPRISM_JPEG_SIZE: 7680 # Size limit for converted image files in pixels (720-30000)
PHOTOPRISM_JPEG_QUALITY: 92 # Set to 95 for high-quality thumbnails (25-100)
TF_CPP_MIN_LOG_LEVEL: 0 # Show TensorFlow log messages for development
# Enable TensorFlow AVX2 support for modern Intel CPUs:
# PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
# Hardware video transcoding options:
# PHOTOPRISM_FFMPEG_BUFFERS: "64" # FFmpeg capture buffers (default: 32)
# PHOTOPRISM_FFMPEG_ENCODER: "h264_v4l2m2m" # Use Video4Linux for AVC transcoding (default: libx264)
# PHOTOPRISM_FFMPEG_ENCODER: "h264_qsv" # Use Intel Quick Sync Video for AVC transcoding (default: libx264)
# PHOTOPRISM_INIT: "intel-graphics tensorflow-amd64-avx2" # Enable TensorFlow AVX2 & Intel Graphics support
# Optional hardware devices for video transcoding and machine learning:
# devices:
# - "/dev/video11:/dev/video11" # Video4Linux (h264_v4l2m2m)
# - "/dev/dri/renderD128:/dev/dri/renderD128" # Intel GPU
working_dir: "/go/src/github.com/photoprism/photoprism"
volumes:
- ".:/go/src/github.com/photoprism/photoprism"
- "go-mod:/go/pkg/mod"
mariadb:
image: mariadb:10.5

View file

@ -21,7 +21,7 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
COPY --chown=root:root --chmod=755 /docker/scripts/*.sh /root/.local/bin/
# Install dev / build dependencies
RUN apt-get update && apt dist-upgrade 2>/dev/null && apt-get -qq install -y --no-install-recommends \
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
build-essential \
ca-certificates \
wget \
@ -116,8 +116,11 @@ RUN rm -rf /tmp/* && mkdir -p /tmp/photoprism && \
wget "https://dl.photoprism.org/tensorflow/facenet.zip?${BUILD_TAG}" -O /tmp/photoprism/facenet.zip && \
wget "https://dl.photoprism.org/qa/testdata.zip?${BUILD_TAG}" -O /tmp/photoprism/testdata.zip
# Install additional tools
COPY --chown=root:root --chmod=755 /docker/scripts/heif-convert.sh /usr/local/bin/heif-convert
# Copy additional files to image
COPY --chown=root:root /docker/scripts/heif-convert.sh /usr/local/bin/heif-convert
COPY --chown=root:root /docker/scripts/Makefile /root/Makefile
COPY --chown=root:root /docker/development/entrypoint.sh /entrypoint.sh
RUN env GO111MODULE=off /usr/local/go/bin/go get -u github.com/tianon/gosu \
golang.org/x/tools/cmd/goimports github.com/kyoh86/richgo && \
[ "$TARGETARCH" = "arm" ] || \
@ -133,6 +136,7 @@ RUN useradd photoprism -m -U -u 1000 -d /photoprism && chmod a+rwx /photoprism &
echo "photoprism ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
chown -Rf photoprism:photoprism /photoprism /var/lib/photoprism /tmp/photoprism && \
chmod -Rf a+rw /photoprism /var/lib/photoprism /tmp/photoprism /go && \
chmod 755 /usr/local/bin/heif-convert /entrypoint.sh && \
find /go -type d -print0 | xargs -0 chmod 777
# Copy mysql client config for development
@ -148,7 +152,6 @@ EXPOSE 2342 2343 9515
VOLUME /var/lib/photoprism
# Configure entrypoint
COPY --chown=root:root --chmod=755 /docker/development/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# Run server

View file

@ -1,7 +1,17 @@
#!/usr/bin/env bash
if [[ $(id -u) = "0" ]]; then
if [[ $(id -u) == "0" ]]; then
echo "development base image started as root"
if [ -e /root/.init ]; then
echo "initialized"
elif [[ ${PHOTOPRISM_INIT} ]]; then
for target in $PHOTOPRISM_INIT; do
echo "init ${target}..."
make -f /root/Makefile "${target}"
done
echo 1 >/root/.init
fi
else
echo "development base image started as uid $(id -u)"
fi
@ -21,7 +31,7 @@ if [[ ${PHOTOPRISM_UMASK} =~ $re ]]; then
fi
# Script runs as root?
if [[ $(id -u) = "0" ]]; then
if [[ $(id -u) == "0" ]]; then
# Legacy user ID env variable in use?
if [[ -z ${PHOTOPRISM_UID} ]] && [[ ${UID} =~ $re ]] && [[ ${UID} != "0" ]]; then
PHOTOPRISM_UID=${UID}
@ -40,7 +50,7 @@ if [[ $(id -u) = "0" ]]; then
useradd -o -u "${PHOTOPRISM_UID}" -g "${PHOTOPRISM_GID}" -d /photoprism "user_${PHOTOPRISM_UID}" 2>/dev/null
usermod -g "${PHOTOPRISM_GID}" "user_${PHOTOPRISM_UID}" 2>/dev/null
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]] ; then
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]]; then
echo "set PHOTOPRISM_DISABLE_CHOWN: \"true\" to disable storage permission updates"
echo "updating storage permissions..."
chown -Rf "${PHOTOPRISM_UID}:${PHOTOPRISM_GID}" /photoprism /var/lib/photoprism /tmp/photoprism /go
@ -55,7 +65,7 @@ if [[ $(id -u) = "0" ]]; then
useradd -o -u "${PHOTOPRISM_UID}" -g 1000 -d /photoprism "user_${PHOTOPRISM_UID}" 2>/dev/null
usermod -g 1000 "user_${PHOTOPRISM_UID}" 2>/dev/null
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]] ; then
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]]; then
echo "set PHOTOPRISM_DISABLE_CHOWN: \"true\" to disable storage permission updates"
echo "updating storage permissions..."
chown -Rf "${PHOTOPRISM_UID}" /photoprism /var/lib/photoprism /tmp/photoprism /go
@ -83,4 +93,4 @@ fi
PID=$!
trap "kill $PID" INT TERM
wait
wait

View file

@ -57,6 +57,7 @@ services:
PHOTOPRISM_PUBLIC: "false" # No authentication required (disables password protection)
PHOTOPRISM_READONLY: "false" # Don't modify originals directory (reduced functionality)
PHOTOPRISM_EXPERIMENTAL: "false" # Enables experimental features
PHOTOPRISM_DISABLE_CHOWN: "false" # Disables storage permission updates on startup
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI
PHOTOPRISM_DISABLE_TENSORFLOW: "false" # Disables all features depending on TensorFlow
@ -83,9 +84,9 @@ services:
# PHOTOPRISM_GID: 1000
# PHOTOPRISM_UMASK: 0000
HOME: "/photoprism"
# For hardware AVC transcoding using the h264_v4l2m2m encoder:
# Optional hardware devices for video transcoding and machine learning:
# devices:
# - "/dev/video11:/dev/video11"
# - "/dev/video11:/dev/video11" # Video4Linux (h264_v4l2m2m)
working_dir: "/photoprism"
volumes:
# Your photo and video files ([local path]:[container path]):

View file

@ -44,11 +44,11 @@
"echo 'APT::Install-Suggests \"false\";' > /etc/apt/apt.conf.d/80suggests",
"echo 'APT::Get::Assume-Yes \"true\";' > /etc/apt/apt.conf.d/80forceyes",
"echo 'APT::Get::Fix-Missing \"true\";' > /etc/apt/apt.conf.d/80fixmissing",
"apt-get -qqy update",
"apt-get -qq update",
"apt dist-upgrade 2>/dev/null",
"apt-get -qqy install {{user `apt_packages`}}",
"apt-get -qqy autoclean",
"apt-get -qqy autoremove",
"apt-get -qq install {{user `apt_packages`}}",
"apt-get -qq autoclean",
"apt-get -qq autoremove",
"chmod 700 /var/lib/cloud/scripts/per-instance/install_photoprism.sh"
]
},

View file

@ -136,6 +136,7 @@ services:
PHOTOPRISM_PUBLIC: "false" # No authentication required (disables password protection)
PHOTOPRISM_READONLY: "false" # Don't modify originals directory (reduced functionality)
PHOTOPRISM_EXPERIMENTAL: "false" # Enables experimental features
PHOTOPRISM_DISABLE_CHOWN: "false" # Disables storage permission updates on startup
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI
PHOTOPRISM_DISABLE_TENSORFLOW: "false" # Disables all features depending on TensorFlow
@ -149,6 +150,7 @@ services:
PHOTOPRISM_DATABASE_NAME: "photoprism" # MariaDB database schema name
PHOTOPRISM_DATABASE_USER: "photoprism" # MariaDB database user name
PHOTOPRISM_DATABASE_PASSWORD: "_admin_password_" # MariaDB database user password
PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
HOME: "/photoprism"
working_dir: "/photoprism"
volumes:

View file

@ -56,6 +56,7 @@ services:
PHOTOPRISM_PUBLIC: "false" # No authentication required (disables password protection)
PHOTOPRISM_READONLY: "false" # Don't modify originals directory (reduced functionality)
PHOTOPRISM_EXPERIMENTAL: "false" # Enables experimental features
PHOTOPRISM_DISABLE_CHOWN: "false" # Disables storage permission updates on startup
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI
PHOTOPRISM_DISABLE_TENSORFLOW: "false" # Disables all features depending on TensorFlow
@ -79,7 +80,18 @@ services:
# PHOTOPRISM_UID: 1000
# PHOTOPRISM_GID: 1000
# PHOTOPRISM_UMASK: 0000
# Enable TensorFlow AVX2 support for modern Intel CPUs:
# PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
# Hardware video transcoding options:
# PHOTOPRISM_FFMPEG_BUFFERS: "64" # FFmpeg capture buffers (default: 32)
# PHOTOPRISM_FFMPEG_ENCODER: "h264_v4l2m2m" # Use Video4Linux for AVC transcoding (default: libx264)
# PHOTOPRISM_FFMPEG_ENCODER: "h264_qsv" # Use Intel Quick Sync Video for AVC transcoding (default: libx264)
# PHOTOPRISM_INIT: "intel-graphics tensorflow-amd64-avx2" # Enable TensorFlow AVX2 & Intel Graphics support
HOME: "/photoprism"
# Optional hardware devices for video transcoding and machine learning:
# devices:
# - "/dev/video11:/dev/video11" # Video4Linux (h264_v4l2m2m)
# - "/dev/dri/renderD128:/dev/dri/renderD128" # Intel GPU
working_dir: "/photoprism"
volumes:
# Your photo and video files ([local path]:[container path]):

View file

@ -52,6 +52,7 @@ services:
PHOTOPRISM_PUBLIC: "false" # No authentication required (disables password protection)
PHOTOPRISM_READONLY: "false" # Don't modify originals directory (reduced functionality)
PHOTOPRISM_EXPERIMENTAL: "false" # Enables experimental features
PHOTOPRISM_DISABLE_CHOWN: "false" # Disables storage permission updates on startup
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI
PHOTOPRISM_DISABLE_TENSORFLOW: "false" # Disables all features depending on TensorFlow
@ -70,6 +71,7 @@ services:
PHOTOPRISM_SITE_CAPTION: "Browse Your Life"
PHOTOPRISM_SITE_DESCRIPTION: ""
PHOTOPRISM_SITE_AUTHOR: ""
# PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
HOME: "/photoprism"
volumes:
# Your photo and video files ([local path]:[container path]):

View file

@ -59,6 +59,7 @@ services:
PHOTOPRISM_PUBLIC: "false" # No authentication required (disables password protection)
PHOTOPRISM_READONLY: "false" # Don't modify originals directory (reduced functionality)
PHOTOPRISM_EXPERIMENTAL: "false" # Enables experimental features
PHOTOPRISM_DISABLE_CHOWN: "false" # Disables storage permission updates on startup
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI
PHOTOPRISM_DISABLE_TENSORFLOW: "false" # Disables all features depending on TensorFlow
@ -82,6 +83,7 @@ services:
# PHOTOPRISM_UID: 1000
# PHOTOPRISM_GID: 1000
# PHOTOPRISM_UMASK: 0000
# PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
HOME: "/photoprism"
working_dir: "/photoprism"
volumes:

View file

@ -54,6 +54,7 @@ services:
PHOTOPRISM_PUBLIC: "false" # No authentication required (disables password protection)
PHOTOPRISM_READONLY: "false" # Don't modify originals directory (reduced functionality)
PHOTOPRISM_EXPERIMENTAL: "false" # Enables experimental features
PHOTOPRISM_DISABLE_CHOWN: "false" # Disables storage permission updates on startup
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI
PHOTOPRISM_DISABLE_TENSORFLOW: "false" # Disables all features depending on TensorFlow
@ -72,6 +73,7 @@ services:
# PHOTOPRISM_UID: 1000
# PHOTOPRISM_GID: 1000
# PHOTOPRISM_UMASK: 0000
# PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
HOME: "/photoprism"
working_dir: "/photoprism"
volumes:

View file

@ -55,6 +55,7 @@ services:
PHOTOPRISM_PUBLIC: "false" # No authentication required, disables password protection
PHOTOPRISM_READONLY: "false" # Don't modify originals folder; disables import, upload, and delete
PHOTOPRISM_EXPERIMENTAL: "false" # Enables experimental features
PHOTOPRISM_DISABLE_CHOWN: "false" # Disables storage permission updates on startup
PHOTOPRISM_DISABLE_WEBDAV: "false" # Disables built-in WebDAV server
PHOTOPRISM_DISABLE_SETTINGS: "false" # Disables Settings in Web UI
PHOTOPRISM_DISABLE_TENSORFLOW: "false" # Disables all features depending on TensorFlow

View file

@ -31,10 +31,11 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
# Install additional distribution packages
RUN apt-get update && apt dist-upgrade 2>/dev/null && apt-get -qq install -y --no-install-recommends \
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
gpgv \
wget \
curl \
make \
davfs2 \
ca-certificates \
mariadb-client \
@ -83,6 +84,7 @@ ENV TF_CPP_MIN_LOG_LEVEL="2" \
PHOTOPRISM_DATABASE_NAME="photoprism" \
PHOTOPRISM_DATABASE_USER="photoprism" \
PHOTOPRISM_DATABASE_PASSWORD="" \
PHOTOPRISM_DISABLE_CHOWN="false" \
PHOTOPRISM_DISABLE_WEBDAV="false" \
PHOTOPRISM_DISABLE_SETTINGS="false" \
PHOTOPRISM_DISABLE_BACKUPS="false" \
@ -113,10 +115,12 @@ RUN ldconfig
RUN umask 0000 && useradd photoprism -m -U -u 1000 -d /photoprism && chmod a+rwx /photoprism
WORKDIR /photoprism
# Copy files to /photoprism
# Copy additional files to image
COPY --from=build /root/.local/bin/photoprism /photoprism/bin/photoprism
COPY --from=build /root/.photoprism/assets /photoprism/assets
COPY --chown=root:root --chmod=755 /docker/scripts/heif-convert.sh /usr/local/bin/heif-convert
COPY --chown=root:root /docker/scripts/heif-convert.sh /usr/local/bin/heif-convert
COPY --chown=root:root /docker/scripts/Makefile /root/Makefile
COPY --chown=root:root /docker/photoprism/entrypoint.sh /entrypoint.sh
# Create directories
RUN mkdir -m 777 -p \
@ -127,7 +131,8 @@ RUN mkdir -m 777 -p \
/photoprism/storage/config \
/photoprism/storage/cache && \
chown -Rf photoprism:photoprism /photoprism /var/lib/photoprism /tmp/photoprism && \
chmod -Rf a+rwx /photoprism /var/lib/photoprism /tmp/photoprism
chmod -Rf a+rwx /photoprism /var/lib/photoprism /tmp/photoprism && \
chmod 755 /usr/local/bin/heif-convert /entrypoint.sh
# Show photoprism version
RUN photoprism -v
@ -136,7 +141,6 @@ RUN photoprism -v
EXPOSE 2342
# Configure entrypoint
COPY --chown=root:root --chmod=755 /docker/scripts/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
VOLUME /var/lib/photoprism

View file

@ -1,7 +1,17 @@
#!/usr/bin/env bash
if [[ $(id -u) = "0" ]]; then
if [[ $(id -u) == "0" ]]; then
echo "started as root"
if [ -e /root/.init ]; then
echo "initialized"
elif [[ ${PHOTOPRISM_INIT} ]]; then
for target in $PHOTOPRISM_INIT; do
echo "init ${target}..."
make -f /root/Makefile "${target}"
done
echo 1 >/root/.init
fi
fi
re='^[0-9]+$'
@ -19,7 +29,7 @@ if [[ ${PHOTOPRISM_UMASK} =~ $re ]]; then
fi
# Script runs as root?
if [[ $(id -u) = "0" ]]; then
if [[ $(id -u) == "0" ]]; then
# Legacy user ID env variable in use?
if [[ -z ${PHOTOPRISM_UID} ]] && [[ ${UID} =~ $re ]] && [[ ${UID} != "0" ]]; then
PHOTOPRISM_UID=${UID}
@ -38,7 +48,7 @@ if [[ $(id -u) = "0" ]]; then
useradd -o -u "${PHOTOPRISM_UID}" -g "${PHOTOPRISM_GID}" -d /photoprism "user_${PHOTOPRISM_UID}" 2>/dev/null
usermod -g "${PHOTOPRISM_GID}" "user_${PHOTOPRISM_UID}" 2>/dev/null
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]] ; then
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]]; then
echo "set PHOTOPRISM_DISABLE_CHOWN: \"true\" to disable storage permission updates"
echo "updating storage permissions..."
chown -Rf "${PHOTOPRISM_UID}:${PHOTOPRISM_GID}" /photoprism/storage /photoprism/import /photoprism/assets /var/lib/photoprism /tmp/photoprism
@ -53,7 +63,7 @@ if [[ $(id -u) = "0" ]]; then
useradd -o -u "${PHOTOPRISM_UID}" -g 1000 -d /photoprism "user_${PHOTOPRISM_UID}" 2>/dev/null
usermod -g 1000 "user_${PHOTOPRISM_UID}" 2>/dev/null
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]] ; then
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]]; then
echo "set PHOTOPRISM_DISABLE_CHOWN: \"true\" to disable storage permission updates"
echo "updating storage permissions..."
chown -Rf "${PHOTOPRISM_UID}" /photoprism/storage /photoprism/import /photoprism/assets /var/lib/photoprism /tmp/photoprism
@ -81,4 +91,4 @@ fi
PID=$!
trap "kill $PID" INT TERM
wait
wait

28
docker/scripts/Makefile Normal file
View file

@ -0,0 +1,28 @@
# Optional packages and drivers for PhotoPrism
# Maintainer: Michael Mayer <hello@photoprism.org>
.PHONY: tensorflow-amd64-avx tensorflow-amd64-avx-install \
tensorflow-amd64-avx2 tensorflow-amd64-avx2-install \
tensorflow-amd64-cpu tensorflow-amd64-cpu-install \
intel-graphics;
tensorflow-amd64-avx: /tmp/libtensorflow-linux-avx-1.15.2.tar.gz tensorflow-amd64-avx-install
/tmp/libtensorflow-linux-avx-1.15.2.tar.gz:
curl -fsSL "https://dl.photoprism.org/tensorflow/linux/libtensorflow-linux-avx-1.15.2.tar.gz" > /tmp/libtensorflow-linux-avx-1.15.2.tar.gz
tensorflow-amd64-avx-install:
tar --overwrite -C "/usr" -xzf /tmp/libtensorflow-linux-avx-1.15.2.tar.gz
ldconfig
tensorflow-amd64-avx2: /tmp/libtensorflow-linux-avx2-1.15.2.tar.gz tensorflow-amd64-avx2-install
/tmp/libtensorflow-linux-avx2-1.15.2.tar.gz:
curl -fsSL "https://dl.photoprism.org/tensorflow/linux/libtensorflow-linux-avx2-1.15.2.tar.gz" > /tmp/libtensorflow-linux-avx2-1.15.2.tar.gz
tensorflow-amd64-avx2-install:
tar --overwrite -C "/usr" -xzf /tmp/libtensorflow-linux-avx2-1.15.2.tar.gz
ldconfig
tensorflow-amd64-cpu: /tmp/libtensorflow-linux-cpu-1.15.2.tar.gz tensorflow-amd64-cpu-install
/tmp/libtensorflow-linux-cpu-1.15.2.tar.gz:
curl -fsSL "https://dl.photoprism.org/tensorflow/linux/libtensorflow-linux-cpu-1.15.2.tar.gz" > /tmp/libtensorflow-linux-cpu-1.15.2.tar.gz
tensorflow-amd64-cpu-install:
tar --overwrite -C "/usr" -xzf /tmp/libtensorflow-linux-cpu-1.15.2.tar.gz
ldconfig
intel-graphics:
apt-get update
apt-get install intel-opencl-icd intel-media-va-driver-non-free libmfx1
apt-get -y autoremove && apt-get -y autoclean && apt-get clean && rm -rf /var/lib/apt/lists/*

View file

@ -18,8 +18,8 @@ else
exit 1
fi
echo "$URL"
curl -L "$URL" | \
tar -C "/usr" -xz && \
curl -fsSL "$URL" | \
tar --overwrite -C "/usr" -xz && \
ldconfig
echo "Done"
fi