Creates accounts to run PhotoPrism under a custom user ID. Also adds them to the video and render groups, which might help to access hardware transcoding devices.
This commit is contained in:
parent
27b84365da
commit
c2baf2ae5a
2
Makefile
2
Makefile
|
@ -85,7 +85,7 @@ install:
|
|||
(cd $(DESTDIR) && mkdir -p bin sbin lib assets config config/examples)
|
||||
./scripts/build.sh prod "$(DESTDIR)/bin/$(BINARY_NAME)"
|
||||
[ -f "$(GOBIN)/gosu" ] || go install github.com/tianon/gosu@latest
|
||||
cp $(GOBIN)/gosu $(DESTDIR)/sbin/gosu
|
||||
cp $(GOBIN)/gosu $(DESTDIR)/usr/local/sbin/gosu
|
||||
[ ! -f "$(GOBIN)/exif-read-tool" ] || cp $(GOBIN)/exif-read-tool $(DESTDIR)/bin/exif-read-tool
|
||||
rsync -r -l --safe-links --exclude-from=assets/.buildignore --chmod=a+r,u+rw ./assets/ $(DESTDIR)/assets
|
||||
cp scripts/dist/heif-convert.sh $(DESTDIR)/bin/heif-convert
|
||||
|
|
|
@ -18,14 +18,15 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="develop" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
NODE_ENV="production" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TMPDIR="/tmp" \
|
||||
LD_LIBRARY_PATH="/root/.local/lib:/usr/local/lib:/usr/lib" \
|
||||
TF_CPP_MIN_LOG_LEVEL="0" \
|
||||
GOPATH="/go" \
|
||||
GOBIN="/go/bin" \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin" \
|
||||
GO111MODULE="on" \
|
||||
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
|
||||
|
||||
|
@ -96,9 +97,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/scripts/install-nodejs.sh && \
|
||||
/scripts/install-tensorflow.sh && \
|
||||
/scripts/install-go.sh && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
echo 'alias ll="ls -alh"' >> /etc/skel/.bashrc && \
|
||||
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /etc/skel/.bashrc /root/.bashrc && \
|
||||
/scripts/create-users.sh && \
|
||||
/scripts/cleanup.sh && \
|
||||
mkdir -p "/go/src" "/go/bin" && \
|
||||
chmod -R 777 "/go" && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
install -d -m 0777 -o 1000 -g 1000 \
|
||||
/var/lib/photoprism \
|
||||
/tmp/photoprism \
|
||||
|
@ -109,24 +115,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/photoprism/storage/albums \
|
||||
/photoprism/storage/backups \
|
||||
/photoprism/storage/config \
|
||||
/photoprism/storage/cache \
|
||||
&& \
|
||||
wget "https://dl.photoprism.app/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/photoprism/nsfw.zip && \
|
||||
/photoprism/storage/cache
|
||||
|
||||
# download models and testdata
|
||||
RUN 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 && \
|
||||
wget "https://dl.photoprism.app/qa/testdata.zip?${BUILD_TAG}" -O /tmp/photoprism/testdata.zip
|
||||
|
||||
# install Go tools
|
||||
RUN /usr/local/go/bin/go install github.com/tianon/gosu@latest; \
|
||||
cp /go/bin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu && \
|
||||
echo "alias ll='ls -alh'" > /photoprism/.bash_aliases && \
|
||||
echo "alias ll='ls -alh'" > /root/.bash_aliases && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
chmod -R a+rwX /go
|
||||
|
||||
# set up project directory
|
||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="prod" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
TMPDIR="/tmp" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TF_CPP_MIN_LOG_LEVEL="2"
|
||||
|
@ -33,22 +35,23 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
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 && \
|
||||
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 && \
|
||||
groupadd -f -g 99 unraid && \
|
||||
useradd -m -g 99 -u 99 -d /photoprism -G video,render unraid && \
|
||||
chown 1000:1000 /photoprism && \
|
||||
chmod -R a+rwX /photoprism && \
|
||||
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
|
||||
apt-get update && apt-get -qq dist-upgrade && \
|
||||
apt-get -qq install \
|
||||
libc6 ca-certificates sudo bash tzdata \
|
||||
gpg zip unzip wget curl rsync make nano \
|
||||
jq lsof lshw sqlite3 mariadb-client \
|
||||
exiftool darktable rawtherapee libheif-examples librsvg2-bin \
|
||||
ffmpeg ffmpegthumbnailer libavcodec-extra libwebm1 \
|
||||
libmatroska7 libdvdread8 libebml5 libgav1-0 libatomic1 \
|
||||
libx264-163 libx265-199 && \
|
||||
libx264-163 libx265-199 \
|
||||
&& \
|
||||
echo 'alias ll="ls -alh"' >> /etc/skel/.bashrc && \
|
||||
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: /scripts/entrypoint-init.sh" >> /etc/sudoers.d/init && \
|
||||
cp /etc/skel/.bashrc /root/.bashrc && \
|
||||
/scripts/create-users.sh && \
|
||||
/scripts/cleanup.sh && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
install -d -m 0777 -o 1000 -g 1000 \
|
||||
/var/lib/photoprism \
|
||||
/tmp/photoprism \
|
||||
|
@ -59,11 +62,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/photoprism/storage/albums \
|
||||
/photoprism/storage/backups \
|
||||
/photoprism/storage/config \
|
||||
/photoprism/storage/cache \
|
||||
&& \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: /scripts/entrypoint-init.sh" >> /etc/sudoers.d/init && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
/scripts/cleanup.sh
|
||||
/photoprism/storage/cache
|
||||
|
||||
# define default directory and user
|
||||
WORKDIR /photoprism
|
||||
|
|
|
@ -19,13 +19,14 @@ ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
|||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="develop" \
|
||||
NODE_ENV="production" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TMPDIR="/tmp" \
|
||||
LD_LIBRARY_PATH="/root/.local/lib:/usr/local/lib:/usr/lib" \
|
||||
TF_CPP_MIN_LOG_LEVEL="0" \
|
||||
GOPATH="/go" \
|
||||
GOBIN="/go/bin" \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin" \
|
||||
GO111MODULE="on" \
|
||||
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
|
||||
|
||||
|
@ -40,23 +41,17 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
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 && \
|
||||
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 && \
|
||||
groupadd -f -g 99 unraid && \
|
||||
useradd -m -g 99 -u 99 -d /photoprism -G video,render unraid && \
|
||||
chown 1000:1000 /photoprism && \
|
||||
chmod -R a+rwX /photoprism && \
|
||||
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
|
||||
apt-get update && apt-get -qq dist-upgrade && \
|
||||
apt-get -qq install \
|
||||
libc6 ca-certificates sudo bash tzdata \
|
||||
gpg zip unzip wget curl rsync make nano \
|
||||
jq lsof lshw sqlite3 mariadb-client \
|
||||
exiftool darktable rawtherapee libheif-examples librsvg2-bin \
|
||||
ffmpeg ffmpegthumbnailer libavcodec-extra libwebm1 \
|
||||
libmatroska7 libdvdread8 libebml5 libgav1-0 libatomic1 \
|
||||
libx264-163 libx265-199 && \
|
||||
apt-get -qq install --no-install-recommends \
|
||||
libx264-163 libx265-199 \
|
||||
&& \
|
||||
apt-get -qq install \
|
||||
apt-utils pkg-config software-properties-common \
|
||||
build-essential gcc g++ git gettext davfs2 chrpath apache2-utils \
|
||||
chromium chromium-driver chromium-sandbox firefox-esr \
|
||||
|
@ -67,11 +62,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/scripts/install-nodejs.sh && \
|
||||
/scripts/install-tensorflow.sh && \
|
||||
/scripts/install-go.sh && \
|
||||
/scripts/cleanup.sh && \
|
||||
mkdir -p "/go/src" "/go/bin" && \
|
||||
chmod -R 777 "/go" && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
chmod -R a+rwX /go && \
|
||||
echo 'alias go=richgo ll="ls -alh"' >> /etc/skel/.bashrc && \
|
||||
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /etc/skel/.bashrc /root/.bashrc && \
|
||||
/scripts/create-users.sh && \
|
||||
/scripts/cleanup.sh && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
install -d -m 0777 -o 1000 -g 1000 \
|
||||
/var/lib/photoprism \
|
||||
/tmp/photoprism \
|
||||
|
@ -90,15 +88,6 @@ RUN wget "https://dl.photoprism.app/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/ph
|
|||
wget "https://dl.photoprism.app/tensorflow/facenet.zip?${BUILD_TAG}" -O /tmp/photoprism/facenet.zip && \
|
||||
wget "https://dl.photoprism.app/qa/testdata.zip?${BUILD_TAG}" -O /tmp/photoprism/testdata.zip
|
||||
|
||||
# set up dev environment & tools
|
||||
RUN cp /go/bin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu && \
|
||||
echo "alias go=richgo ll='ls -alh'" > /photoprism/.bash_aliases && \
|
||||
echo "alias go=richgo ll='ls -alh'" > /root/.bash_aliases && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert
|
||||
|
||||
# set up project directory
|
||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="prod" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
TMPDIR="/tmp" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TF_CPP_MIN_LOG_LEVEL="2"
|
||||
|
@ -63,6 +65,13 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
&& \
|
||||
/scripts/install-mariadb.sh mariadb-client && \
|
||||
/scripts/install-darktable.sh && \
|
||||
echo 'alias ll="ls -alh"' >> /etc/skel/.bashrc && \
|
||||
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: /scripts/entrypoint-init.sh" >> /etc/sudoers.d/init && \
|
||||
cp /etc/skel/.bashrc /root/.bashrc && \
|
||||
/scripts/create-users.sh && \
|
||||
/scripts/cleanup.sh && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
install -d -m 0777 -o 1000 -g 1000 \
|
||||
/var/lib/photoprism \
|
||||
/tmp/photoprism \
|
||||
|
@ -73,11 +82,7 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/photoprism/storage/albums \
|
||||
/photoprism/storage/backups \
|
||||
/photoprism/storage/config \
|
||||
/photoprism/storage/cache \
|
||||
&& \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: /scripts/entrypoint-init.sh" >> /etc/sudoers.d/init && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
/scripts/cleanup.sh
|
||||
/photoprism/storage/cache
|
||||
|
||||
# define default directory and user
|
||||
WORKDIR /photoprism
|
||||
|
|
|
@ -19,13 +19,14 @@ ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
|||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="develop" \
|
||||
NODE_ENV="production" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TMPDIR="/tmp" \
|
||||
LD_LIBRARY_PATH="/root/.local/lib:/usr/local/lib:/usr/lib" \
|
||||
TF_CPP_MIN_LOG_LEVEL="0" \
|
||||
GOPATH="/go" \
|
||||
GOBIN="/go/bin" \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin" \
|
||||
GO111MODULE="on" \
|
||||
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
|
||||
|
||||
|
@ -45,7 +46,8 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
groupadd -f -g 1000 photoprism && \
|
||||
useradd -m -g 1000 -u 1000 -d /photoprism -G video,render photoprism && \
|
||||
chmod 777 /photoprism && \
|
||||
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
|
||||
apt-get update && apt-get -qq dist-upgrade && \
|
||||
apt-get -qq install \
|
||||
apt-utils \
|
||||
gpg \
|
||||
pkg-config \
|
||||
|
@ -103,9 +105,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/scripts/install-mariadb.sh mariadb-client && \
|
||||
/scripts/install-tensorflow.sh && \
|
||||
/scripts/install-darktable.sh && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
echo 'alias go=richgo ll="ls -alh"' >> /etc/skel/.bashrc && \
|
||||
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /etc/skel/.bashrc /root/.bashrc && \
|
||||
/scripts/create-users.sh && \
|
||||
/scripts/cleanup.sh && \
|
||||
mkdir -p "/go/src" "/go/bin" && \
|
||||
chmod -R 777 "/go" && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
install -d -m 0777 -o 1000 -g 1000 \
|
||||
/var/lib/photoprism \
|
||||
/tmp/photoprism \
|
||||
|
@ -116,28 +123,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/photoprism/storage/albums \
|
||||
/photoprism/storage/backups \
|
||||
/photoprism/storage/config \
|
||||
/photoprism/storage/cache \
|
||||
&& \
|
||||
wget "https://dl.photoprism.app/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/photoprism/nsfw.zip && \
|
||||
/photoprism/storage/cache
|
||||
|
||||
# download models and testdata
|
||||
RUN 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 && \
|
||||
wget "https://dl.photoprism.app/qa/testdata.zip?${BUILD_TAG}" -O /tmp/photoprism/testdata.zip
|
||||
|
||||
# install Go tools
|
||||
RUN /usr/local/go/bin/go install github.com/tianon/gosu@latest && \
|
||||
/usr/local/go/bin/go install golang.org/x/tools/cmd/goimports@latest && \
|
||||
/usr/local/go/bin/go install github.com/kyoh86/richgo@latest && \
|
||||
/usr/local/go/bin/go install github.com/psampaz/go-mod-outdated@latest && \
|
||||
/usr/local/go/bin/go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest; \
|
||||
cp /go/bin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu && \
|
||||
echo "alias go=richgo ll='ls -alh'" > /photoprism/.bash_aliases && \
|
||||
echo "alias go=richgo ll='ls -alh'" > /root/.bash_aliases && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
chmod -R a+rwX /go
|
||||
|
||||
# set up project directory
|
||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||
|
||||
|
|
|
@ -18,14 +18,15 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="develop" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
NODE_ENV="production" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TMPDIR="/tmp" \
|
||||
LD_LIBRARY_PATH="/root/.local/lib:/usr/local/lib:/usr/lib" \
|
||||
TF_CPP_MIN_LOG_LEVEL="0" \
|
||||
GOPATH="/go" \
|
||||
GOBIN="/go/bin" \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin" \
|
||||
GO111MODULE="on" \
|
||||
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
|
||||
|
||||
|
@ -102,9 +103,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/scripts/install-nodejs.sh && \
|
||||
/scripts/install-tensorflow.sh && \
|
||||
/scripts/install-darktable.sh && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
echo 'alias go=richgo ll="ls -alh"' >> /etc/skel/.bashrc && \
|
||||
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /etc/skel/.bashrc /root/.bashrc && \
|
||||
/scripts/create-users.sh && \
|
||||
/scripts/cleanup.sh && \
|
||||
mkdir -p "/go/src" "/go/bin" && \
|
||||
chmod -R 777 "/go" && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
install -d -m 0777 -o 1000 -g 1000 \
|
||||
/var/lib/photoprism \
|
||||
/tmp/photoprism \
|
||||
|
@ -115,28 +121,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/photoprism/storage/albums \
|
||||
/photoprism/storage/backups \
|
||||
/photoprism/storage/config \
|
||||
/photoprism/storage/cache \
|
||||
&& \
|
||||
wget "https://dl.photoprism.app/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/photoprism/nsfw.zip && \
|
||||
/photoprism/storage/cache
|
||||
|
||||
# download models and testdata
|
||||
RUN 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 && \
|
||||
wget "https://dl.photoprism.app/qa/testdata.zip?${BUILD_TAG}" -O /tmp/photoprism/testdata.zip
|
||||
|
||||
# install Go tools
|
||||
RUN /usr/local/go/bin/go install github.com/tianon/gosu@latest && \
|
||||
/usr/local/go/bin/go install golang.org/x/tools/cmd/goimports@latest && \
|
||||
/usr/local/go/bin/go install github.com/kyoh86/richgo@latest && \
|
||||
/usr/local/go/bin/go install github.com/psampaz/go-mod-outdated@latest && \
|
||||
/usr/local/go/bin/go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest; \
|
||||
cp /go/bin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu && \
|
||||
echo "alias go=richgo ll='ls -alh'" > /photoprism/.bash_aliases && \
|
||||
echo "alias go=richgo ll='ls -alh'" > /root/.bash_aliases && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
chmod -R a+rwX /go
|
||||
|
||||
# set up project directory
|
||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||
|
||||
|
|
|
@ -18,14 +18,15 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="develop" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
NODE_ENV="production" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TMPDIR="/tmp" \
|
||||
LD_LIBRARY_PATH="/root/.local/lib:/usr/local/lib:/usr/lib" \
|
||||
TF_CPP_MIN_LOG_LEVEL="0" \
|
||||
GOPATH="/go" \
|
||||
GOBIN="/go/bin" \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin" \
|
||||
GO111MODULE="on" \
|
||||
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
|
||||
|
||||
|
@ -103,9 +104,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/scripts/install-darktable.sh && \
|
||||
/scripts/install-chrome.sh && \
|
||||
/scripts/install-go.sh && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
echo 'alias go=richgo ll="ls -alh"' >> /etc/skel/.bashrc && \
|
||||
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /etc/skel/.bashrc /root/.bashrc && \
|
||||
/scripts/create-users.sh && \
|
||||
/scripts/cleanup.sh && \
|
||||
mkdir -p "/go/src" "/go/bin" && \
|
||||
chmod -R 777 "/go" && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
install -d -m 0777 -o 1000 -g 1000 \
|
||||
/var/lib/photoprism \
|
||||
/tmp/photoprism \
|
||||
|
@ -116,28 +122,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/photoprism/storage/albums \
|
||||
/photoprism/storage/backups \
|
||||
/photoprism/storage/config \
|
||||
/photoprism/storage/cache \
|
||||
&& \
|
||||
wget "https://dl.photoprism.app/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/photoprism/nsfw.zip && \
|
||||
/photoprism/storage/cache
|
||||
|
||||
# download models and testdata
|
||||
RUN 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 && \
|
||||
wget "https://dl.photoprism.app/qa/testdata.zip?${BUILD_TAG}" -O /tmp/photoprism/testdata.zip
|
||||
|
||||
# install Go tools
|
||||
RUN /usr/local/go/bin/go install github.com/tianon/gosu@latest && \
|
||||
/usr/local/go/bin/go install golang.org/x/tools/cmd/goimports@latest && \
|
||||
/usr/local/go/bin/go install github.com/kyoh86/richgo@latest && \
|
||||
/usr/local/go/bin/go install github.com/psampaz/go-mod-outdated@latest && \
|
||||
/usr/local/go/bin/go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest; \
|
||||
cp /go/bin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu && \
|
||||
echo "alias go=richgo ll='ls -alh'" > /photoprism/.bash_aliases && \
|
||||
echo "alias go=richgo ll='ls -alh'" > /root/.bash_aliases && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
chmod -R a+rwX /go
|
||||
|
||||
# set up project directory
|
||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||
|
||||
|
|
|
@ -18,14 +18,15 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="develop" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
NODE_ENV="production" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TMPDIR="/tmp" \
|
||||
LD_LIBRARY_PATH="/root/.local/lib:/usr/local/lib:/usr/lib" \
|
||||
TF_CPP_MIN_LOG_LEVEL="0" \
|
||||
GOPATH="/go" \
|
||||
GOBIN="/go/bin" \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin" \
|
||||
GO111MODULE="on" \
|
||||
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
|
||||
|
||||
|
@ -44,7 +45,8 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
groupadd -f -g 1000 photoprism && \
|
||||
useradd -m -g 1000 -u 1000 -d /photoprism -G video,render photoprism && \
|
||||
chmod 777 /photoprism && \
|
||||
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
|
||||
apt-get update && apt-get -qq dist-upgrade && \
|
||||
apt-get -qq install \
|
||||
apt-utils \
|
||||
gpg \
|
||||
gpg-agent \
|
||||
|
@ -103,9 +105,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/scripts/install-darktable.sh && \
|
||||
/scripts/install-chrome.sh && \
|
||||
/scripts/install-go.sh && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
echo 'alias go=richgo ll="ls -alh"' >> /etc/skel/.bashrc && \
|
||||
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /etc/skel/.bashrc /root/.bashrc && \
|
||||
/scripts/create-users.sh && \
|
||||
/scripts/cleanup.sh && \
|
||||
mkdir -p "/go/src" "/go/bin" && \
|
||||
chmod -R 777 "/go" && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
install -d -m 0777 -o 1000 -g 1000 \
|
||||
/var/lib/photoprism \
|
||||
/tmp/photoprism \
|
||||
|
@ -116,28 +123,14 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
/photoprism/storage/albums \
|
||||
/photoprism/storage/backups \
|
||||
/photoprism/storage/config \
|
||||
/photoprism/storage/cache \
|
||||
&& \
|
||||
wget "https://dl.photoprism.app/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/photoprism/nsfw.zip && \
|
||||
/photoprism/storage/cache
|
||||
|
||||
# download models and testdata
|
||||
RUN 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 && \
|
||||
wget "https://dl.photoprism.app/qa/testdata.zip?${BUILD_TAG}" -O /tmp/photoprism/testdata.zip
|
||||
|
||||
# install Go tools
|
||||
RUN /usr/local/go/bin/go install github.com/tianon/gosu@latest && \
|
||||
/usr/local/go/bin/go install golang.org/x/tools/cmd/goimports@latest && \
|
||||
/usr/local/go/bin/go install github.com/kyoh86/richgo@latest && \
|
||||
/usr/local/go/bin/go install github.com/psampaz/go-mod-outdated@latest && \
|
||||
/usr/local/go/bin/go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest; \
|
||||
cp /go/bin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu && \
|
||||
echo "alias go=richgo ll='ls -alh'" > /photoprism/.bash_aliases && \
|
||||
echo "alias go=richgo ll='ls -alh'" > /root/.bash_aliases && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
cp /scripts/heif-convert.sh /usr/local/bin/heif-convert && \
|
||||
chmod -R a+rwX /go
|
||||
|
||||
# set up project directory
|
||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||
|
||||
|
|
|
@ -99,7 +99,6 @@ services:
|
|||
# PHOTOPRISM_UID: 1000
|
||||
# PHOTOPRISM_GID: 1000
|
||||
# PHOTOPRISM_UMASK: 0000
|
||||
HOME: "/photoprism" # do not change or remove
|
||||
## Start as a non-root user (see https://docs.docker.com/engine/reference/run/#user)
|
||||
# user: "1000:1000"
|
||||
## Share hardware devices with FFmpeg and TensorFlow (optional):
|
||||
|
|
|
@ -91,7 +91,6 @@ services:
|
|||
# PHOTOPRISM_UID: 1000
|
||||
# PHOTOPRISM_GID: 1000
|
||||
# PHOTOPRISM_UMASK: 0000
|
||||
HOME: "/photoprism" # do not change or remove
|
||||
## Start as a non-root user (see https://docs.docker.com/engine/reference/run/#user)
|
||||
# user: "1000:1000"
|
||||
## Share hardware devices with FFmpeg and TensorFlow (optional):
|
||||
|
|
|
@ -158,7 +158,6 @@ services:
|
|||
PHOTOPRISM_DATABASE_PASSWORD: "_admin_password_" # MariaDB or MySQL database user password
|
||||
## Run/install on first startup (options: update, gpu, tensorflow, davfs, clean):
|
||||
PHOTOPRISM_INIT: "update tensorflow clean"
|
||||
HOME: "/photoprism" # do not change or remove
|
||||
working_dir: "/photoprism" # do not change or remove
|
||||
## Storage Folders: "~" is a shortcut for your home directory, "." for the current directory
|
||||
volumes:
|
||||
|
|
|
@ -90,7 +90,6 @@ services:
|
|||
# PHOTOPRISM_UID: 1000
|
||||
# PHOTOPRISM_GID: 1000
|
||||
# PHOTOPRISM_UMASK: 0000
|
||||
HOME: "/photoprism" # do not change or remove
|
||||
## Start as a non-root user (see https://docs.docker.com/engine/reference/run/#user)
|
||||
# user: "1000:1000"
|
||||
## Share hardware devices with FFmpeg and TensorFlow (optional):
|
||||
|
|
|
@ -79,7 +79,6 @@ services:
|
|||
PHOTOPRISM_SITE_AUTHOR: ""
|
||||
## Run/install on first startup (options: update, gpu, tensorflow, davfs, clitools, clean):
|
||||
# PHOTOPRISM_INIT: "gpu tensorflow"
|
||||
HOME: "/photoprism" # do not change or remove
|
||||
## Storage Folders: "~" is a shortcut for your home directory, "." for the current directory
|
||||
volumes:
|
||||
# "/host/folder:/photoprism/folder" # example
|
||||
|
|
|
@ -89,7 +89,6 @@ services:
|
|||
# PHOTOPRISM_UID: 1000
|
||||
# PHOTOPRISM_GID: 1000
|
||||
# PHOTOPRISM_UMASK: 0000
|
||||
HOME: "/photoprism" # do not change or remove
|
||||
## Start as a non-root user (see https://docs.docker.com/engine/reference/run/#user)
|
||||
# user: "1000:1000"
|
||||
working_dir: "/photoprism" # do not change or remove
|
||||
|
|
|
@ -82,7 +82,6 @@ services:
|
|||
# PHOTOPRISM_UID: 1000
|
||||
# PHOTOPRISM_GID: 1000
|
||||
# PHOTOPRISM_UMASK: 0000
|
||||
HOME: "/photoprism" # do not change or remove
|
||||
## Start as a non-root user (see https://docs.docker.com/engine/reference/run/#user)
|
||||
# user: "1000:1000"
|
||||
working_dir: "/photoprism" # do not change or remove
|
||||
|
|
|
@ -82,7 +82,6 @@ services:
|
|||
PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
|
||||
PHOTOPRISM_SITE_DESCRIPTION: ""
|
||||
PHOTOPRISM_SITE_AUTHOR: ""
|
||||
HOME: "/photoprism" # do not change or remove
|
||||
working_dir: "/photoprism" # do not change or remove
|
||||
## Storage Folders: use "/" not "\" as separator, "~" is a shortcut for C:/user/{username}, "." for the current directory
|
||||
volumes:
|
||||
|
|
|
@ -24,7 +24,9 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="prod" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
TMPDIR="/tmp" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TF_CPP_MIN_LOG_LEVEL="2" \
|
||||
|
@ -85,9 +87,9 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
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 && \
|
||||
mv /opt/photoprism/sbin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu && \
|
||||
mv /opt/photoprism/usr/local/sbin/gosu /usr/local/sbin/gosu && \
|
||||
chown root:root /usr/local/sbin/gosu && \
|
||||
chmod 755 /usr/local/sbin/gosu && \
|
||||
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 && \
|
||||
chmod 777 /photoprism && \
|
||||
|
|
|
@ -22,7 +22,6 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="prod" \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/opt/photoprism/bin" \
|
||||
TMPDIR="/tmp" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TF_CPP_MIN_LOG_LEVEL="2" \
|
||||
|
@ -88,9 +87,9 @@ EXPOSE 2342
|
|||
|
||||
# copy dist files
|
||||
COPY --from=build /opt/photoprism/ /opt/photoprism
|
||||
RUN mv /opt/photoprism/sbin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu
|
||||
RUN mv /opt/photoprism/usr/local/sbin/gosu /usr/local/sbin/gosu && \
|
||||
chown root:root /usr/local/sbin/gosu && \
|
||||
chmod 755 /usr/local/sbin/gosu
|
||||
|
||||
# set container entrypoint script
|
||||
ENTRYPOINT ["/scripts/entrypoint.sh"]
|
||||
|
|
|
@ -22,7 +22,6 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="prod" \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/opt/photoprism/bin" \
|
||||
TMPDIR="/tmp" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TF_CPP_MIN_LOG_LEVEL="2" \
|
||||
|
@ -88,9 +87,9 @@ EXPOSE 2342
|
|||
|
||||
# copy dist files
|
||||
COPY --from=build /opt/photoprism/ /opt/photoprism
|
||||
RUN mv /opt/photoprism/sbin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu
|
||||
RUN mv /opt/photoprism/usr/local/sbin/gosu /usr/local/sbin/gosu && \
|
||||
chown root:root /usr/local/sbin/gosu && \
|
||||
chmod 755 /usr/local/sbin/gosu
|
||||
|
||||
# set container entrypoint script
|
||||
ENTRYPOINT ["/scripts/entrypoint.sh"]
|
||||
|
|
|
@ -24,7 +24,9 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="prod" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
TMPDIR="/tmp" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TF_CPP_MIN_LOG_LEVEL="2" \
|
||||
|
@ -85,9 +87,9 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
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 && \
|
||||
mv /opt/photoprism/sbin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu && \
|
||||
mv /opt/photoprism/usr/local/sbin/gosu /usr/local/sbin/gosu && \
|
||||
chown root:root /usr/local/sbin/gosu && \
|
||||
chmod 755 /usr/local/sbin/gosu && \
|
||||
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 && \
|
||||
chmod 777 /photoprism && \
|
||||
|
|
|
@ -24,7 +24,9 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="prod" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
TMPDIR="/tmp" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TF_CPP_MIN_LOG_LEVEL="2" \
|
||||
|
@ -84,9 +86,9 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
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 && \
|
||||
mv /opt/photoprism/sbin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu && \
|
||||
mv /opt/photoprism/usr/local/sbin/gosu /usr/local/sbin/gosu && \
|
||||
chown root:root /usr/local/sbin/gosu && \
|
||||
chmod 755 /usr/local/sbin/gosu && \
|
||||
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 && \
|
||||
chmod 777 /photoprism && \
|
||||
|
|
|
@ -24,7 +24,9 @@ ARG BUILD_TAG
|
|||
ENV PHOTOPRISM_ARCH=$TARGETARCH \
|
||||
DOCKER_TAG=$BUILD_TAG \
|
||||
DOCKER_ENV="prod" \
|
||||
PS1="\u@$DOCKER_TAG:\w\$ " \
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/opt/photoprism/bin" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:/usr/lib" \
|
||||
TMPDIR="/tmp" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
TF_CPP_MIN_LOG_LEVEL="2" \
|
||||
|
@ -84,9 +86,9 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
|||
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 && \
|
||||
mv /opt/photoprism/sbin/gosu /sbin/gosu && \
|
||||
chown root:root /sbin/gosu && \
|
||||
chmod 755 /sbin/gosu && \
|
||||
mv /opt/photoprism/usr/local/sbin/gosu /usr/local/sbin/gosu && \
|
||||
chown root:root /usr/local/sbin/gosu && \
|
||||
chmod 755 /usr/local/sbin/gosu && \
|
||||
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 && \
|
||||
chmod 777 /photoprism && \
|
||||
|
|
26
scripts/dist/create-users.sh
vendored
Executable file
26
scripts/dist/create-users.sh
vendored
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts"
|
||||
|
||||
# abort if not executed as root
|
||||
if [ $(id -u) != "0" ]; then
|
||||
echo "Usage: run ${0##*/} as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Creating default users and groups..."
|
||||
|
||||
groupadd -f -r -g 44 video
|
||||
groupadd -f -r -g 109 render
|
||||
groupadd -f -g 1000 photoprism
|
||||
|
||||
add_user()
|
||||
{
|
||||
useradd -u "$1" -g photoprism -G video,render -s /bin/bash -m -d "/home/user-$1" "user-$1" 2>/dev/null
|
||||
}
|
||||
|
||||
for i in $(seq 50 99); do add_user "$i"; done
|
||||
for i in $(seq 500 549); do add_user "$i"; done
|
||||
for i in $(seq 1000 1099); do add_user "$i"; done
|
||||
|
||||
echo "Done."
|
27
scripts/dist/entrypoint-init.sh
vendored
27
scripts/dist/entrypoint-init.sh
vendored
|
@ -15,17 +15,17 @@ re='^[0-9]+$'
|
|||
# detect environment
|
||||
case $DOCKER_ENV in
|
||||
prod)
|
||||
export PATH="/usr/local/sbin:/usr/sbin:/sbin:/bin:/scripts:/opt/photoprism/bin:/usr/local/bin:/usr/bin";
|
||||
export PATH="/usr/local/sbin:/usr/sbin:/sbin:/bin:/usr/local/bin:/usr/bin:/scripts:/opt/photoprism/bin";
|
||||
INIT_SCRIPTS="/scripts"
|
||||
CHOWN_DIRS=("/photoprism" "/opt/photoprism")
|
||||
CHMOD_DIRS=("/opt/photoprism")
|
||||
;;
|
||||
|
||||
develop)
|
||||
export PATH="/usr/local/sbin:/usr/sbin:/sbin:/bin:/scripts:/usr/local/go/bin:/go/bin:/usr/local/bin:/usr/bin";
|
||||
export PATH="/usr/local/sbin:/usr/sbin:/sbin:/bin:/usr/local/bin:/usr/bin:/scripts:/usr/local/go/bin:/go/bin:/opt/photoprism/bin";
|
||||
INIT_SCRIPTS="/go/src/github.com/photoprism/photoprism/scripts/dist"
|
||||
CHOWN_DIRS=("/go /photoprism" "/opt/photoprism" "/tmp/photoprism")
|
||||
CHMOD_DIRS=("/photoprism" "/opt/photoprism" "/tmp/photoprism")
|
||||
CHOWN_DIRS=("/photoprism" "/opt/photoprism" "/go" "/tmp/photoprism")
|
||||
CHMOD_DIRS=("/opt/photoprism" "/tmp/photoprism")
|
||||
;;
|
||||
|
||||
*)
|
||||
|
@ -41,22 +41,11 @@ if [[ ${PHOTOPRISM_UID} =~ $re ]] && [[ ${PHOTOPRISM_UID} != "0" ]]; then
|
|||
CHOWN="${PHOTOPRISM_UID}"
|
||||
fi
|
||||
|
||||
if [[ ${PHOTOPRISM_UID} -ge 500 ]]; then
|
||||
if [[ ${PHOTOPRISM_GID} =~ $re ]] && [[ ${PHOTOPRISM_GID} != "0" ]] && [[ ${PHOTOPRISM_GID} -ge 500 ]]; then
|
||||
groupadd -g "${PHOTOPRISM_GID}" "group_${PHOTOPRISM_GID}" 2>/dev/null
|
||||
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
|
||||
else
|
||||
useradd -o -u "${PHOTOPRISM_UID}" -g 1000 -d "/photoprism" "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
usermod -g 1000 "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${CHOWN} ]] && [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]]; then
|
||||
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]] || [[ ${PHOTOPRISM_DISABLE_CHOWN} == "false" ]]; then
|
||||
echo "init: updating filesystem permissions"
|
||||
echo "note: PHOTOPRISM_DISABLE_CHOWN=\"true\" disables permission updates"
|
||||
chown --preserve-root -Rcf "${CHOWN}" "${CHOWN_DIRS[@]}"
|
||||
chmod --preserve-root -Rcf u+rwX "${CHMOD_DIRS[@]}"
|
||||
echo "PHOTOPRISM_DISABLE_CHOWN=\"true\" disables permission updates"
|
||||
chown --preserve-root --no-dereference --silent -R "${CHOWN}" "${CHOWN_DIRS[@]}"
|
||||
chmod --preserve-root --no-dereference --silent -R u+rwX "${CHMOD_DIRS[@]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
10
scripts/dist/entrypoint.sh
vendored
10
scripts/dist/entrypoint.sh
vendored
|
@ -47,7 +47,7 @@ fi
|
|||
if [[ ${INIT_SCRIPT} ]] && [[ -f "${INIT_SCRIPT}" ]]; then
|
||||
if [[ $(/usr/bin/id -u) == "0" ]]; then
|
||||
echo "started $DOCKER_TAG as root ($PHOTOPRISM_ARCH-$DOCKER_ENV)"
|
||||
/bin/bash -c "${INIT_SCRIPT}"
|
||||
/bin/bash -c "${INIT_SCRIPT}"
|
||||
else
|
||||
echo "started $DOCKER_TAG as uid $(/usr/bin/id -u) ($PHOTOPRISM_ARCH-$DOCKER_ENV)"
|
||||
/usr/bin/sudo -E "${INIT_SCRIPT}"
|
||||
|
@ -96,15 +96,15 @@ if [[ ${INIT_SCRIPT} ]] && [[ $(/usr/bin/id -u) == "0" ]] && [[ ${PHOTOPRISM_UID
|
|||
echo "${@}"
|
||||
|
||||
# run command as uid:gid
|
||||
([[ ${DOCKER_ENV} != "prod" ]] || /sbin/gosu "${PHOTOPRISM_UID}:${PHOTOPRISM_GID}" "/scripts/audit.sh") \
|
||||
&& /sbin/gosu "${PHOTOPRISM_UID}:${PHOTOPRISM_GID}" "$@" &
|
||||
([[ ${DOCKER_ENV} != "prod" ]] || /usr/local/sbin/gosu "${PHOTOPRISM_UID}:${PHOTOPRISM_GID}" "/scripts/audit.sh") \
|
||||
&& /usr/local/sbin/gosu "${PHOTOPRISM_UID}:${PHOTOPRISM_GID}" "$@" &
|
||||
else
|
||||
echo "switching to uid ${PHOTOPRISM_UID}"
|
||||
echo "${@}"
|
||||
|
||||
# run command as uid
|
||||
([[ ${DOCKER_ENV} != "prod" ]] || /sbin/gosu "${PHOTOPRISM_UID}" "/scripts/audit.sh") \
|
||||
&& /sbin/gosu "${PHOTOPRISM_UID}" "$@" &
|
||||
([[ ${DOCKER_ENV} != "prod" ]] || /usr/local/sbin/gosu "${PHOTOPRISM_UID}" "/scripts/audit.sh") \
|
||||
&& /usr/local/sbin/gosu "${PHOTOPRISM_UID}" "$@" &
|
||||
fi
|
||||
else
|
||||
echo "running as uid $(id -u)"
|
||||
|
|
37
scripts/dist/install-go-tools.sh
vendored
37
scripts/dist/install-go-tools.sh
vendored
|
@ -8,13 +8,38 @@ if [[ $(id -u) != "0" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
echo "Installing Go Tools..."
|
||||
if [[ -z "$GOPATH" ]] || [[ -z "$GOBIN" ]]; then
|
||||
echo "\$GOPATH and \$GOBIN must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
|
||||
DESTARCH=${2:-$SYSTEM_ARCH}
|
||||
|
||||
echo "Installing Go Tools for ${DESTARCH^^}..."
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p "$GOPATH/src" "$GOBIN"
|
||||
|
||||
go install github.com/tianon/gosu@latest
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
go install github.com/kyoh86/richgo@latest
|
||||
go install github.com/psampaz/go-mod-outdated@latest
|
||||
go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest
|
||||
go install github.com/mikefarah/yq/v4@latest
|
||||
|
||||
# no additional tools on ARMv7 to reduce build time
|
||||
if [[ $DESTARCH != "arm" ]]; then
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
go install github.com/psampaz/go-mod-outdated@latest
|
||||
go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest
|
||||
go install github.com/mikefarah/yq/v4@latest
|
||||
|
||||
go install github.com/kyoh86/richgo@latest
|
||||
cp "$GOBIN/richgo" /usr/local/bin/richgo
|
||||
fi
|
||||
|
||||
chmod -R a+rwX "$GOPATH"
|
||||
|
||||
# install gosu in /usr/local/sbin
|
||||
cp "$GOBIN/gosu" /usr/local/sbin/gosu
|
||||
chown root:root /usr/local/sbin/gosu
|
||||
chmod 755 /usr/local/sbin/gosu
|
||||
|
||||
echo "Done."
|
||||
|
|
Loading…
Reference in a new issue