Docker: Update and improve scripts for installing CPU/GPU support #1337

This commit is contained in:
Michael Mayer 2022-02-25 16:33:46 +01:00
parent 00739770d7
commit 427d2132aa
36 changed files with 260 additions and 138 deletions

View file

@ -107,20 +107,19 @@ services:
PHOTOPRISM_OIDC_ISSUER_URL: "https://keycloak.localssl.dev/auth/realms/master"
PHOTOPRISM_OIDC_CLIENT_ID: "photoprism-develop"
PHOTOPRISM_OIDC_CLIENT_SECRET: "9d8351a0-ca01-4556-9c37-85eb634869b9"
## Enable TensorFlow AVX2 support for modern Intel CPUs (requires starting the container as root):
# PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
## Add/update packages (service must be started as root; options: update, gpu, tensorflow, davfs, clean):
# PHOTOPRISM_INIT: "update gpu tensorflow clean"
## Hardware video transcoding config (optional):
# PHOTOPRISM_FFMPEG_BUFFERS: "64" # FFmpeg capture buffers (default: 32)
# PHOTOPRISM_FFMPEG_BITRATE: "32" # FFmpeg encoding bitrate limit in Mbit/s (default: 50)
# 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
# PHOTOPRISM_INIT: "install-updates" # installs general operating system updates
## Hardware devices for video transcoding and machine learning (optional):
## Share hardware devices for video transcoding and machine learning (optional):
# devices:
# - "/dev/dri:/dev/dri"
# - "/dev/nvidia0:/dev/nvidia0"
# - "/dev/nvidiactl:/dev/nvidiactl"
# - "/dev/video11:/dev/video11" # Video4Linux (h264_v4l2m2m)
# - "/dev/dri/renderD128:/dev/dri/renderD128" # Intel GPU
# - "/dev/dri/card0:/dev/dri/card0"
working_dir: "/go/src/github.com/photoprism/photoprism"
volumes:
- ".:/go/src/github.com/photoprism/photoprism"

View file

@ -23,7 +23,7 @@ ENV DOCKER_ARCH=$TARGETARCH \
# copy scripts and debian backports sources list
COPY --chown=root:root --chmod=755 /scripts/dist/* /root/.local/bin/
COPY --chown=root:root --chmod=644 /docker/develop/bullseye/backports.list /etc/apt/sources.list.d/backports.list
COPY --chown=root:root --chmod=644 /docker/develop/bullseye/sources.list /etc/apt/sources.list.d/bullseye.list
COPY --chown=root:root --chmod=755 /docker/develop/entrypoint.sh /entrypoint.sh
COPY --chown=root:root --chmod=644 /.my.cnf /etc/my.cnf
@ -33,7 +33,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
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 && \
useradd -m -U -u 1000 -d /photoprism photoprism && \
groupadd -f -r -g 44 video && groupadd -f -r -g 109 render && groupadd -f -g 1000 photoprism && \
useradd -m -g 1000 -u 1000 -d /photoprism -G video,render photoprism && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
apt-utils \
gpg \
@ -44,14 +45,19 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
gcc \
g++ \
sudo \
bash \
make \
nano \
lsof \
lshw \
git \
jq \
git \
zip \
unzip \
wget \
curl \
rsync \
unzip \
sqlite3 \
chrpath \
gettext \
@ -76,7 +82,7 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra \
sudo && \
&& \
/root/.local/bin/install-nodejs.sh && \
/root/.local/bin/install-tensorflow.sh && \
/root/.local/bin/install-go.sh && \
@ -93,7 +99,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
/photoprism/storage/albums \
/photoprism/storage/backups \
/photoprism/storage/config \
/photoprism/storage/cache && \
/photoprism/storage/cache \
&& \
wget "https://dl.photoprism.app/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/photoprism/nsfw.zip && \
wget "https://dl.photoprism.app/tensorflow/nasnet.zip?${BUILD_TAG}" -O /tmp/photoprism/nasnet.zip && \
wget "https://dl.photoprism.app/tensorflow/facenet.zip?${BUILD_TAG}" -O /tmp/photoprism/facenet.zip && \

View file

@ -17,7 +17,7 @@ ENV DOCKER_ARCH=$TARGETARCH \
# copy scripts and debian backports sources list
COPY /scripts/dist/ /opt/photoprism/scripts
COPY /docker/develop/bullseye/backports.list /etc/apt/sources.list.d/backports.list
COPY /docker/develop/bullseye/sources.list /etc/apt/sources.list.d/bullseye.list
# install additional distribution packages
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
@ -25,10 +25,14 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
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 && \
useradd -m -U -u 1000 -d /photoprism photoprism && \
groupadd -f -r -g 44 video && groupadd -f -r -g 109 render && groupadd -f -g 1000 photoprism && \
useradd -m -g 1000 -u 1000 -d /photoprism -G video,render photoprism && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
ca-certificates \
jq \
zip \
gpg \
lshw \
wget \
curl \
make \
@ -42,7 +46,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
rawtherapee \
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra && \
libavcodec-extra \
&& \
install-mariadb.sh mariadb-client && \
install-darktable.sh && \
install -d -m 0777 -o 1000 -g 1000 \
@ -55,7 +60,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
/photoprism/storage/albums \
/photoprism/storage/backups \
/photoprism/storage/config \
/photoprism/storage/cache && \
/photoprism/storage/cache \
&& \
cleanup.sh
# define default directory and user

View file

@ -23,7 +23,7 @@ ENV DOCKER_ARCH=$TARGETARCH \
# copy scripts and debian backports sources list
COPY --chown=root:root --chmod=755 /scripts/dist/* /root/.local/bin/
COPY --chown=root:root --chmod=644 /docker/develop/bullseye/backports.list /etc/apt/sources.list.d/backports.list
COPY --chown=root:root --chmod=644 /docker/develop/bullseye/sources.list /etc/apt/sources.list.d/bullseye.list
COPY --chown=root:root --chmod=755 /docker/develop/entrypoint.sh /entrypoint.sh
COPY --chown=root:root --chmod=644 /.my.cnf /etc/my.cnf
@ -33,7 +33,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
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 && \
useradd -m -U -u 1000 -d /photoprism photoprism && \
groupadd -f -r -g 44 video && groupadd -f -r -g 109 render && groupadd -f -g 1000 photoprism && \
useradd -m -g 1000 -u 1000 -d /photoprism -G video,render photoprism && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
apt-utils \
gpg \
@ -47,12 +48,15 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
bash \
make \
nano \
lsof \
lshw \
wget \
curl \
rsync \
unzip \
zip \
jq \
git \
zip \
unzip \
gettext \
chromium \
chromium-driver \
@ -83,8 +87,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
libavcodec-extra \
davfs2 \
chrpath \
lsof \
apache2-utils && \
apache2-utils \
&& \
/root/.local/bin/install-nodejs.sh && \
/root/.local/bin/install-mariadb.sh mariadb-client && \
/root/.local/bin/install-tensorflow.sh && \
@ -102,7 +106,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
/photoprism/storage/albums \
/photoprism/storage/backups \
/photoprism/storage/config \
/photoprism/storage/cache && \
/photoprism/storage/cache \
&& \
wget "https://dl.photoprism.app/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/photoprism/nsfw.zip && \
wget "https://dl.photoprism.app/tensorflow/nasnet.zip?${BUILD_TAG}" -O /tmp/photoprism/nasnet.zip && \
wget "https://dl.photoprism.app/tensorflow/facenet.zip?${BUILD_TAG}" -O /tmp/photoprism/facenet.zip && \

View file

@ -1 +0,0 @@
deb http://deb.debian.org/debian bullseye-backports main contrib non-free

View file

@ -0,0 +1,4 @@
deb http://deb.debian.org/debian bullseye contrib non-free
deb http://deb.debian.org/debian bullseye-updates contrib non-free
deb http://deb.debian.org/debian bullseye-backports main contrib non-free
deb http://security.debian.org/debian-security bullseye-security contrib non-free

View file

@ -23,7 +23,7 @@ ENV DOCKER_ARCH=$TARGETARCH \
# copy scripts and debian backports sources list
COPY --chown=root:root --chmod=755 /scripts/dist/* /root/.local/bin/
COPY --chown=root:root --chmod=644 /docker/develop/buster/backports.list /etc/apt/sources.list.d/backports.list
COPY --chown=root:root --chmod=644 /docker/develop/buster/sources.list /etc/apt/sources.list.d/buster.list
COPY --chown=root:root --chmod=755 /docker/develop/entrypoint.sh /entrypoint.sh
COPY --chown=root:root --chmod=644 /.my.cnf /etc/my.cnf
@ -33,7 +33,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
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 && \
useradd -m -U -u 1000 -d /photoprism photoprism && \
groupadd -f -r -g 44 video && groupadd -f -r -g 109 render && groupadd -f -g 1000 photoprism && \
useradd -m -g 1000 -u 1000 -d /photoprism -G video,render photoprism && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
apt-utils \
gpg \
@ -47,12 +48,15 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
bash \
make \
nano \
lsof \
lshw \
wget \
curl \
rsync \
unzip \
zip \
jq \
git \
zip \
unzip \
gettext \
chromium \
chromium-driver \
@ -83,8 +87,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
libavcodec-extra \
davfs2 \
chrpath \
lsof \
apache2-utils && \
apache2-utils \
&& \
/root/.local/bin/install-nodejs.sh && \
/root/.local/bin/install-tensorflow.sh && \
/root/.local/bin/install-darktable.sh && \
@ -101,7 +105,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
/photoprism/storage/albums \
/photoprism/storage/backups \
/photoprism/storage/config \
/photoprism/storage/cache && \
/photoprism/storage/cache \
&& \
wget "https://dl.photoprism.app/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/photoprism/nsfw.zip && \
wget "https://dl.photoprism.app/tensorflow/nasnet.zip?${BUILD_TAG}" -O /tmp/photoprism/nasnet.zip && \
wget "https://dl.photoprism.app/tensorflow/facenet.zip?${BUILD_TAG}" -O /tmp/photoprism/facenet.zip && \

View file

@ -1 +0,0 @@
deb http://deb.debian.org/debian buster-backports main contrib non-free

View file

@ -0,0 +1,4 @@
deb http://deb.debian.org/debian buster contrib non-free
deb http://deb.debian.org/debian buster-updates contrib non-free
deb http://deb.debian.org/debian buster-backports main contrib non-free
deb http://security.debian.org/debian-security buster-security contrib non-free

View file

@ -32,7 +32,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
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 && \
useradd -m -U -u 1000 -d /photoprism photoprism && \
groupadd -f -r -g 44 video && groupadd -f -r -g 109 render && groupadd -f -g 1000 photoprism && \
useradd -m -g 1000 -u 1000 -d /photoprism -G video,render photoprism && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
apt-utils \
gpg \
@ -43,12 +44,18 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
build-essential \
g++ \
gcc \
sudo \
bash \
make \
nano \
lsof \
lshw \
wget \
curl \
jq \
git \
zip \
unzip \
gettext \
firefox \
mariadb-client \
@ -70,8 +77,6 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
libxtst6 \
librsvg2-bin \
rsync \
unzip \
zip \
sqlite3 \
tzdata \
libheif-examples \
@ -80,10 +85,9 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra \
lsof \
apache2-utils \
fonts-roboto \
sudo && \
&& \
/root/.local/bin/install-nodejs.sh && \
/root/.local/bin/install-tensorflow.sh && \
/root/.local/bin/install-darktable.sh && \
@ -102,7 +106,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
/photoprism/storage/albums \
/photoprism/storage/backups \
/photoprism/storage/config \
/photoprism/storage/cache && \
/photoprism/storage/cache \
&& \
wget "https://dl.photoprism.app/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/photoprism/nsfw.zip && \
wget "https://dl.photoprism.app/tensorflow/nasnet.zip?${BUILD_TAG}" -O /tmp/photoprism/nasnet.zip && \
wget "https://dl.photoprism.app/tensorflow/facenet.zip?${BUILD_TAG}" -O /tmp/photoprism/facenet.zip && \

View file

@ -91,6 +91,8 @@ services:
PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
PHOTOPRISM_SITE_DESCRIPTION: ""
PHOTOPRISM_SITE_AUTHOR: ""
## Add/update packages (service must be started as root; options: update, gpu, tensorflow, davfs, clean):
# PHOTOPRISM_INIT: "update clean"
## Run as a specific user, group, or with a custom umask (does not work together with "user:")
# PHOTOPRISM_UID: 1000
# PHOTOPRISM_GID: 1000
@ -98,7 +100,7 @@ services:
HOME: "/photoprism"
## Start as a non-root user (see https://docs.docker.com/engine/reference/run/#user)
# user: "1000:1000"
## Hardware devices for video transcoding and machine learning (optional)
## Share hardware devices for video transcoding and machine learning (optional):
# devices:
# - "/dev/video11:/dev/video11" # Video4Linux (h264_v4l2m2m)
working_dir: "/photoprism"

View file

@ -84,6 +84,8 @@ services:
PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
PHOTOPRISM_SITE_DESCRIPTION: ""
PHOTOPRISM_SITE_AUTHOR: ""
## Add/update packages (service must be started as root; options: update, gpu, tensorflow, davfs, clean):
# PHOTOPRISM_INIT: "update clean"
## Run as a specific user, group, or with a custom umask (does not work together with "user:")
# PHOTOPRISM_UID: 1000
# PHOTOPRISM_GID: 1000
@ -91,7 +93,7 @@ services:
HOME: "/photoprism"
## Start as a non-root user (see https://docs.docker.com/engine/reference/run/#user)
# user: "1000:1000"
## Hardware devices for video transcoding and machine learning (optional)
## Share hardware devices for video transcoding and machine learning (optional):
# devices:
# - "/dev/video11:/dev/video11" # Video4Linux (h264_v4l2m2m)
working_dir: "/photoprism"

View file

@ -154,7 +154,8 @@ services:
PHOTOPRISM_DATABASE_NAME: "photoprism" # MariaDB or MySQL database schema name
PHOTOPRISM_DATABASE_USER: "photoprism" # MariaDB or MySQL database user name
PHOTOPRISM_DATABASE_PASSWORD: "_admin_password_" # MariaDB or MySQL database user password
PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
## Add/update packages (service must be started as root; options: update, gpu, tensorflow, davfs, clean):
PHOTOPRISM_INIT: "update tensorflow clean"
HOME: "/photoprism"
working_dir: "/photoprism"
## Storage Folders: "~" is a shortcut for your home directory, "." for the current directory

View file

@ -79,14 +79,13 @@ services:
PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
PHOTOPRISM_SITE_DESCRIPTION: ""
PHOTOPRISM_SITE_AUTHOR: ""
## Add/update packages (service must be started as root; options: update, gpu, tensorflow, davfs, clean):
# PHOTOPRISM_INIT: "update gpu tensorflow clean"
## Hardware video transcoding config (optional)
# PHOTOPRISM_FFMPEG_BUFFERS: "64" # FFmpeg capture buffers (default: 32)
# PHOTOPRISM_FFMPEG_BITRATE: "32" # FFmpeg encoding bitrate limit in Mbit/s (default: 50)
# 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
## Enable TensorFlow AVX2 support for modern Intel CPUs (requires starting the container as root)
# PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
## Run as a specific user, group, or with a custom umask (does not work together with "user:")
# PHOTOPRISM_UID: 1000
# PHOTOPRISM_GID: 1000
@ -94,11 +93,12 @@ services:
HOME: "/photoprism"
## Start as a non-root user (see https://docs.docker.com/engine/reference/run/#user)
# user: "1000:1000"
## Hardware devices for video transcoding and machine learning (optional)
## Share hardware devices for video transcoding and machine learning (optional):
# devices:
# - "/dev/dri:/dev/dri"
# - "/dev/nvidia0:/dev/nvidia0"
# - "/dev/nvidiactl:/dev/nvidiactl"
# - "/dev/video11:/dev/video11" # Video4Linux (h264_v4l2m2m)
# - "/dev/dri/renderD128:/dev/dri/renderD128" # Intel GPU
# - "/dev/dri/card0:/dev/dri/card0"
working_dir: "/photoprism"
## Storage Folders: "~" is a shortcut for your home directory, "." for the current directory
volumes:

View file

@ -75,8 +75,8 @@ services:
PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
PHOTOPRISM_SITE_DESCRIPTION: ""
PHOTOPRISM_SITE_AUTHOR: ""
## Enable TensorFlow AVX2 support for modern Intel CPUs (requires starting the container as root)
# PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
## Add/update packages (service must be started as root; options: update, gpu, tensorflow, davfs, clean):
# PHOTOPRISM_INIT: "update gpu tensorflow clean"
HOME: "/photoprism"
## Storage Folders: "~" is a shortcut for your home directory, "." for the current directory
volumes:

View file

@ -81,8 +81,8 @@ services:
PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
PHOTOPRISM_SITE_DESCRIPTION: ""
PHOTOPRISM_SITE_AUTHOR: ""
## Enable TensorFlow AVX2 support for modern Intel CPUs (requires starting the container as root)
# PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
## Add/update packages (service must be started as root; options: update, gpu, tensorflow, davfs, clean):
# PHOTOPRISM_INIT: "update gpu tensorflow clean"
## Run as a specific user, group, or with a custom umask (does not work together with "user:")
# PHOTOPRISM_UID: 1000
# PHOTOPRISM_GID: 1000

View file

@ -74,8 +74,8 @@ services:
PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
PHOTOPRISM_SITE_DESCRIPTION: ""
PHOTOPRISM_SITE_AUTHOR: ""
## Enable TensorFlow AVX2 support for modern Intel CPUs (requires starting the container as root)
# PHOTOPRISM_INIT: "tensorflow-amd64-avx2"
### Add/update packages (service must be started as root; options: update, gpu, tensorflow, davfs, clean):
# PHOTOPRISM_INIT: "update gpu tensorflow clean"
## Run as a specific user, group, or with a custom umask (does not work together with "user:")
# PHOTOPRISM_UID: 1000
# PHOTOPRISM_GID: 1000

View file

@ -76,7 +76,7 @@ ENV DOCKER_ARCH=$TARGETARCH \
# copy app dist files and debian backports sources list
COPY --from=build /opt/photoprism/ /opt/photoprism
COPY /docker/develop/bullseye/backports.list /etc/apt/sources.list.d/backports.list
COPY /docker/develop/bullseye/sources.list /etc/apt/sources.list.d/bullseye.list
# install additional distribution packages
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
@ -86,10 +86,13 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing && \
cp /opt/photoprism/bin/gosu /bin/gosu && \
chown root:root /bin/gosu && \
useradd -m -U -u 1000 -d /photoprism photoprism && \
groupadd -f -r -g 44 video && groupadd -f -r -g 109 render && groupadd -f -g 1000 photoprism && \
useradd -m -g 1000 -u 1000 -d /photoprism -G video,render photoprism && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
ca-certificates \
jq \
gpg \
lshw \
wget \
curl \
make \
@ -104,7 +107,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
rawtherapee \
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra && \
libavcodec-extra \
&& \
install -d -m 0777 -o 1000 -g 1000 \
/var/lib/photoprism \
/tmp/photoprism \
@ -115,7 +119,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
/photoprism/storage/albums \
/photoprism/storage/backups \
/photoprism/storage/config \
/photoprism/storage/cache && \
/photoprism/storage/cache \
&& \
cleanup.sh
# define default directory and user

View file

@ -76,7 +76,7 @@ ENV DOCKER_ARCH=$TARGETARCH \
# copy app dist files and debian backports sources list
COPY --from=build /opt/photoprism/ /opt/photoprism
COPY --chown=root:root --chmod=644 /docker/develop/buster/backports.list /etc/apt/sources.list.d/backports.list
COPY --chown=root:root --chmod=644 /docker/develop/buster/sources.list /etc/apt/sources.list.d/buster.list
# install additional distribution packages
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
@ -86,10 +86,13 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing && \
cp /opt/photoprism/bin/gosu /bin/gosu && \
chown root:root /bin/gosu && \
useradd -m -U -u 1000 -d /photoprism photoprism && \
groupadd -f -r -g 44 video && groupadd -f -r -g 109 render && groupadd -f -g 1000 photoprism && \
useradd -m -g 1000 -u 1000 -d /photoprism -G video,render photoprism && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
ca-certificates \
jq \
gpg \
lshw \
wget \
curl \
make \
@ -104,7 +107,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
rawtherapee \
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra && \
libavcodec-extra \
&& \
install-darktable.sh && \
install -d -m 0777 -o 1000 -g 1000 \
/var/lib/photoprism \
@ -116,7 +120,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
/photoprism/storage/albums \
/photoprism/storage/backups \
/photoprism/storage/config \
/photoprism/storage/cache && \
/photoprism/storage/cache \
&& \
cleanup.sh
# define default directory and user

View file

@ -85,9 +85,12 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing && \
cp /opt/photoprism/bin/gosu /bin/gosu && \
chown root:root /bin/gosu && \
useradd -m -U -u 1000 -d /photoprism photoprism && \
groupadd -f -r -g 44 video && groupadd -f -r -g 109 render && groupadd -f -g 1000 photoprism && \
useradd -m -g 1000 -u 1000 -d /photoprism -G video,render photoprism && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
ca-certificates \
jq \
lshw \
gpg \
wget \
curl \
@ -103,7 +106,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
rawtherapee \
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra && \
libavcodec-extra \
&& \
install-darktable.sh && \
install -d -m 0777 -o 1000 -g 1000 \
/var/lib/photoprism \
@ -115,7 +119,8 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
/photoprism/storage/albums \
/photoprism/storage/backups \
/photoprism/storage/config \
/photoprism/storage/cache && \
/photoprism/storage/cache \
&& \
cleanup.sh
# define default directory and user

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
if [[ -z $1 ]] || [[ -z $2 ]]; then
echo "Usage: build.sh [debug|race|static|prod] [filename]" 1>&2
echo "Usage: ${0##*/} [debug|race|static|prod] [filename]" 1>&2
exit 1
fi

57
scripts/dist/Makefile vendored
View file

@ -1,37 +1,28 @@
# INSTALLS OPTIONAL PACKAGES AND DRIVERS IN DOCKER IMAGES
# Maintainer: Michael Mayer <hello@photoprism.app>
.PHONY: apt-upgrade apt-cleanup install-davfs install-updates install-intel-graphics intel-graphics \
tensorflow-amd64-cpu tensorflow-amd64-cpu-install \
tensorflow-amd64-avx tensorflow-amd64-avx-install \
tensorflow-amd64-avx2 tensorflow-amd64-avx2-install;
intel-graphics: gpu
install-intel-graphics: gpu
install-davfs: davfs
tensorflow-amd64-cpu: tensorflow
tensorflow-amd64-avx: tensorflow
tensorflow-amd64-avx2: tensorflow
apt-cleanup: clean
apt-upgrade: update
update:
apt-get update
apt-get -qq dist-upgrade
clean:
apt-get -y autoremove
apt-get -y autoclean
rm -rf /var/lib/apt/lists/*
gpu:
install-gpu.sh
tensorflow:
install-tensorflow.sh auto
davfs:
install-davfs.sh
install-updates: apt-upgrade apt-cleanup
intel-graphics: apt-upgrade install-intel-graphics apt-cleanup
tensorflow-amd64-cpu: /tmp/libtensorflow-linux-cpu-1.15.2.tar.gz tensorflow-amd64-cpu-install
tensorflow-amd64-avx: /tmp/libtensorflow-linux-avx-1.15.2.tar.gz tensorflow-amd64-avx-install
tensorflow-amd64-avx2: /tmp/libtensorflow-linux-avx2-1.15.2.tar.gz tensorflow-amd64-avx2-install
apt-upgrade:
apt-get -y update
apt-get -y dist-upgrade
apt-cleanup:
apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/*
install-davfs:
apt-get -y install davfs2
install-intel-graphics:
apt-get -y install intel-opencl-icd intel-media-va-driver-non-free i965-va-driver-shaders libmfx1
/tmp/libtensorflow-linux-cpu-1.15.2.tar.gz:
curl -fsSL "https://dl.photoprism.app/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
/tmp/libtensorflow-linux-avx-1.15.2.tar.gz:
curl -fsSL "https://dl.photoprism.app/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
/tmp/libtensorflow-linux-avx2-1.15.2.tar.gz:
curl -fsSL "https://dl.photoprism.app/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
.PHONY: update apt-upgrade clean apt-cleanup gpu tensorflow davfs install-davfs \
tensorflow-amd64-cpu tensorflow-amd64-avx tensorflow-amd64-avx2 install-davfs \
intel-graphics install-intel-graphics;

View file

@ -2,7 +2,7 @@
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run cleanup.sh as root" 1>&2
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
fi

View file

@ -2,7 +2,7 @@
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run dist-upgrade.sh as root" 1>&2
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
fi

View file

@ -2,21 +2,20 @@
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run install-chrome.sh as root" 1>&2
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
fi
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
INSTALL_ARCH=${2:-$SYSTEM_ARCH}
DESTARCH=${2:-$SYSTEM_ARCH}
. /etc/os-release
if [[ $INSTALL_ARCH != "amd64" ]]; then
if [[ $DESTARCH != "amd64" ]]; then
echo "Google Chrome (stable) is only available for AMD64."
exit
fi
. /etc/os-release
echo "Installing Google Chrome (stable) on ${ID} for ${INSTALL_ARCH^^}..."
echo "Installing Google Chrome (stable) on ${ID} for ${DESTARCH^^}..."
set -e

View file

@ -2,20 +2,20 @@
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run install-darktable.sh as root" 1>&2
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
fi
set -e
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
INSTALL_ARCH=${2:-$SYSTEM_ARCH}
DESTARCH=${2:-$SYSTEM_ARCH}
. /etc/os-release
echo "Installing Darktable for ${INSTALL_ARCH^^}..."
echo "Installing Darktable for ${DESTARCH^^}..."
if [[ $INSTALL_ARCH == "amd64" ]]; then
if [[ $DESTARCH == "amd64" ]]; then
if [[ $VERSION_CODENAME == "bullseye" ]]; then
echo 'deb http://download.opensuse.org/repositories/graphics:/darktable/Debian_11/ /' | tee /etc/apt/sources.list.d/graphics:darktable.list
curl -fsSL https://download.opensuse.org/repositories/graphics:darktable/Debian_11/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/graphics_darktable.gpg > /dev/null
@ -31,7 +31,7 @@ if [[ $INSTALL_ARCH == "amd64" ]]; then
apt-get -qq install darktable
fi
echo "Done."
elif [[ $INSTALL_ARCH == "arm64" ]]; then
elif [[ $DESTARCH == "arm64" ]]; then
if [[ $VERSION_CODENAME == "bullseye" ]]; then
apt-get update
apt-get -qq install -t bullseye-backports darktable
@ -44,5 +44,5 @@ elif [[ $INSTALL_ARCH == "arm64" ]]; then
fi
echo "Done."
else
echo "Unsupported Machine Architecture: $INSTALL_ARCH"
echo "Unsupported Machine Architecture: $DESTARCH"
fi

14
scripts/dist/install-davfs.sh vendored Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
fi
echo "Installing WebDAV filesystem driver..."
apt-get update
apt-get -qq install davfs2
echo "Done."

View file

@ -4,34 +4,34 @@ GOLANG_VERSION=1.17.7
DESTDIR=$(realpath "${1:-/usr/local}")
echo "Installing Go in \"$DESTDIR\"..."
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run install-go.sh as root" 1>&2
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
fi
echo "Installing Go in \"$DESTDIR\"..."
set -e
mkdir -p "$DESTDIR"
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
INSTALL_ARCH=${2:-$SYSTEM_ARCH}
DESTARCH=${2:-$SYSTEM_ARCH}
set -eux;
if [[ $INSTALL_ARCH == "amd64" ]]; then
if [[ $DESTARCH == "amd64" ]]; then
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz"
CHECKSUM="02b111284bedbfa35a7e5b74a06082d18632eff824fd144312f6063943d49259 *go.tgz"
elif [[ $INSTALL_ARCH == "arm64" ]]; then
elif [[ $DESTARCH == "arm64" ]]; then
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-arm64.tar.gz"
CHECKSUM="a5aa1ed17d45ee1d58b4a4099b12f8942acbd1dd09b2e9a6abb1c4898043c5f5 *go.tgz"
elif [[ $INSTALL_ARCH == "arm" ]]; then
elif [[ $DESTARCH == "arm" ]]; then
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-armv6l.tar.gz"
CHECKSUM="874774f078b182fa21ffcb3878467eb5cb7e78bbffa6343ea5f0fbe47983433b *go.tgz"
else
echo "Unsupported Machine Architecture: $INSTALL_ARCH" 1>&2
echo "Unsupported Machine Architecture: $DESTARCH" 1>&2
exit 1
fi

45
scripts/dist/install-gpu.sh vendored Executable file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Error: Run ${0##*/} as root" 1>&2
exit 1
fi
set -e
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
DESTARCH=${DESTARCH:-$SYSTEM_ARCH}
TMPDIR=${TMPDIR:-/tmp}
. /etc/os-release
if [[ $DESTARCH != "amd64" ]]; then
echo "Installing GPU drivers for ${DESTARCH} is not supported yet."
exit
fi
apt-get update
apt-get -qq upgrade
apt-get -qq install lshw jq
# shellcheck disable=SC2207
GPU_DETECTED=($(lshw -c display -json 2>/dev/null | jq -r '.[].configuration.driver'))
# shellcheck disable=SC2068
for t in ${GPU_DETECTED[@]}; do
case $t in
i915)
apt-get -qq install intel-opencl-icd intel-media-va-driver-non-free i965-va-driver-shaders libmfx1 libva2 vainfo libva-wayland2
;;
nvidia)
apt-get -qq install nvidia-vdpau-driver nvidia-driver-libs nvidia-kernel-dkms libva2 vainfo libva-wayland2
;;
*)
echo "Unsupported GPU: \"$t\"";
;;
esac
done
echo "Done."

View file

@ -2,12 +2,12 @@
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run install-mariadb-client.sh as root" 1>&2
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
fi
if [[ -z $1 ]]; then
echo "Usage: install-mariadb.sh [package names...]" 1>&2
echo "Usage: ${0##*/} [package names...]" 1>&2
exit 1
fi

View file

@ -2,7 +2,7 @@
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run install-nodejs.sh as root" 1>&2
echo "Usage: run ${0##*/} as root" 1>&2
exit 1
fi

View file

@ -2,33 +2,44 @@
set -e
TF_VERSION="1.15.2"
TF_VERSION=${TF_VERSION:-1.15.2}
DESTDIR=$(realpath "${1:-/usr}")
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
DESTARCH=${DESTARCH:-$SYSTEM_ARCH}
echo "Installing TensorFlow in \"$DESTDIR\"..."
if [[ $1 == "auto" ]]; then
TF_DRIVER="auto";
DESTDIR="/usr";
else
DESTDIR=$(realpath "${1:-/usr}")
fi
TMPDIR=${TMPDIR:-/tmp}
# abort if the user is not root
if [[ $(id -u) != "0" ]] && [[ $DESTDIR == "/usr" || $DESTDIR == "/usr/local" ]]; then
echo "Error: Run install-tensorflow.sh as root to install in a system directory!" 1>&2
echo "Error: Run ${0##*/} as root to install in a system directory!" 1>&2
exit 1
fi
mkdir -p "$DESTDIR"
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
INSTALL_ARCH=${2:-$SYSTEM_ARCH}
TMPDIR=${TMPDIR:-/tmp}
if [[ $TF_DRIVER == "auto" ]]; then
echo "Detecting driver..."
TF_DRIVER=$("$(dirname "$0")/tensorflow-driver.sh")
fi
if [[ -z $3 ]]; then
INSTALL_FILE="${INSTALL_ARCH}/libtensorflow-${INSTALL_ARCH}-${TF_VERSION}.tar.gz"
if [[ -z $TF_DRIVER ]]; then
echo "Installing TensorFlow ${TF_VERSION} ${DESTARCH^^} in \"$DESTDIR\"..."
INSTALL_FILE="${DESTARCH}/libtensorflow-${DESTARCH}-${TF_VERSION}.tar.gz"
else
INSTALL_FILE="${INSTALL_ARCH}/libtensorflow-${INSTALL_ARCH}-${2}-${TF_VERSION}.tar.gz"
echo "Installing TensorFlow ${TF_VERSION} ${DESTARCH^^} ${TF_DRIVER^^} in \"$DESTDIR\"..."
INSTALL_FILE="${DESTARCH}/libtensorflow-${DESTARCH}-${TF_DRIVER}-${TF_VERSION}.tar.gz"
fi
if [ ! -f "$TMPDIR/$INSTALL_FILE" ]; then
URL="https://dl.photoprism.app/tensorflow/${INSTALL_FILE}"
echo "Downloading $INSTALL_ARCH libs from \"$URL\". Please wait."
echo "Downloading ${DESTARCH} libs from \"$URL\". Please wait."
curl --create-dirs -fsSL -o "$TMPDIR/$INSTALL_FILE" "$URL"
fi
@ -37,7 +48,7 @@ echo "Extracting \"$TMPDIR/$INSTALL_FILE\" to \"$DESTDIR\"..."
if [ -f "$TMPDIR/$INSTALL_FILE" ]; then
tar --overwrite --mode=755 -C "$DESTDIR" -xzf "$TMPDIR/$INSTALL_FILE"
else
echo "Fatal: \"$TMPDI/$INSTALL_FILE\" not found"
echo "Fatal: \"$TMPDIR/$INSTALL_FILE\" not found"
exit 1
fi

9
scripts/dist/tensorflow-driver.sh vendored Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
CPU_DETECTED=$(lshw -c processor -json 2>/dev/null)
if [[ $(echo "${CPU_DETECTED}" | jq -r '.[].capabilities.avx2') == "true" ]]; then
echo "avx2"
elif [[ $(echo "${CPU_DETECTED}" | jq -r '.[].capabilities.avx') == "true" ]]; then
echo "avx"
fi

View file

@ -6,7 +6,7 @@ set -e
export DOCKER_BUILDKIT=1
if [[ -z $1 ]] || [[ -z $2 ]]; then
echo "Usage: scripts/docker/build.sh [name] [tag] [/subimage]" 1>&2
echo "Usage: ${0##*/} [name] [tag] [/subimage]" 1>&2
exit 1
fi

View file

@ -4,7 +4,7 @@
export DOCKER_BUILDKIT=1
if [[ -z $1 ]] || [[ -z $2 ]]; then
echo "Usage: scripts/docker/buildx-multi.sh [name] [linux/amd64|linux/arm64|linux/arm] [tag] [/subimage]" 1>&2
echo "Usage: ${0##*/} [name] [linux/amd64|linux/arm64|linux/arm] [tag] [/subimage]" 1>&2
exit 1
fi

View file

@ -4,7 +4,7 @@
export DOCKER_BUILDKIT=1
if [[ -z $1 ]] || [[ -z $2 ]]; then
echo "Usage: scripts/docker/buildx.sh [name] linux/[amd64|arm64|arm] [tag] [/subimage]" 1>&2
echo "Usage: ${0##*/} [name] linux/[amd64|arm64|arm] [tag] [/subimage]" 1>&2
exit 1
fi