2021-05-15 12:05:52 +00:00
|
|
|
FROM ubuntu:21.04
|
2018-11-08 09:56:11 +00:00
|
|
|
|
2021-05-16 14:08:49 +00:00
|
|
|
LABEL maintainer="Michael Mayer <hello@photoprism.org>"
|
2018-11-08 09:56:11 +00:00
|
|
|
|
2021-06-02 09:04:31 +00:00
|
|
|
ARG TARGETARCH
|
|
|
|
ARG TARGETPLATFORM
|
2019-05-16 06:41:16 +00:00
|
|
|
ARG BUILD_TAG
|
|
|
|
|
2021-05-15 12:05:52 +00:00
|
|
|
# Set environment variables
|
|
|
|
ENV DEBIAN_FRONTEND="noninteractive" \
|
2021-06-02 09:04:31 +00:00
|
|
|
TMPDIR="/tmp"
|
2018-11-12 05:58:39 +00:00
|
|
|
|
2021-02-15 11:08:04 +00:00
|
|
|
# Configure apt
|
2020-08-12 08:25:50 +00:00
|
|
|
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
|
|
|
|
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
|
|
|
|
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \
|
|
|
|
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes && \
|
2021-07-08 19:36:37 +00:00
|
|
|
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
|
2018-11-12 05:58:39 +00:00
|
|
|
|
2021-06-02 09:04:31 +00:00
|
|
|
# Copy scripts to /root/.local/bin
|
|
|
|
COPY --chown=root:root --chmod=755 /docker/scripts/*.sh /root/.local/bin/
|
|
|
|
|
2018-11-09 09:56:52 +00:00
|
|
|
# Install dev / build dependencies
|
2021-08-31 16:08:37 +00:00
|
|
|
RUN apt-get update && apt dist-upgrade 2>/dev/null && apt-get -qq install -y --no-install-recommends \
|
2018-11-12 05:58:39 +00:00
|
|
|
build-essential \
|
2021-02-26 10:06:20 +00:00
|
|
|
ca-certificates \
|
|
|
|
wget \
|
2018-11-12 05:58:39 +00:00
|
|
|
curl \
|
2021-02-26 10:06:20 +00:00
|
|
|
davfs2 \
|
2019-05-07 13:41:33 +00:00
|
|
|
chrpath \
|
|
|
|
libssl-dev \
|
|
|
|
libxft-dev \
|
|
|
|
libfreetype6 \
|
2018-11-12 05:58:39 +00:00
|
|
|
libfreetype6-dev \
|
2019-05-07 13:41:33 +00:00
|
|
|
libfontconfig1 \
|
|
|
|
libfontconfig1-dev \
|
2018-11-12 05:58:39 +00:00
|
|
|
libhdf5-serial-dev \
|
|
|
|
libpng-dev \
|
|
|
|
libzmq3-dev \
|
2020-08-25 12:57:45 +00:00
|
|
|
libx264-dev \
|
|
|
|
libx265-dev \
|
2018-11-12 05:58:39 +00:00
|
|
|
pkg-config \
|
|
|
|
software-properties-common \
|
|
|
|
rsync \
|
|
|
|
unzip \
|
2019-06-06 12:44:29 +00:00
|
|
|
zip \
|
2018-11-12 05:58:39 +00:00
|
|
|
g++ \
|
|
|
|
gcc \
|
|
|
|
libc6-dev \
|
|
|
|
gpg-agent \
|
|
|
|
apt-utils \
|
|
|
|
make \
|
|
|
|
nano \
|
|
|
|
git \
|
2020-07-14 23:26:54 +00:00
|
|
|
gettext \
|
2020-12-11 09:30:04 +00:00
|
|
|
mariadb-client \
|
|
|
|
sqlite3 \
|
2019-05-07 13:41:33 +00:00
|
|
|
tzdata \
|
2019-05-09 04:18:22 +00:00
|
|
|
gconf-service \
|
2019-06-06 12:44:29 +00:00
|
|
|
firefox \
|
|
|
|
libheif-examples \
|
2020-02-03 22:40:45 +00:00
|
|
|
exiftool \
|
2020-08-12 08:42:19 +00:00
|
|
|
rawtherapee \
|
2020-05-30 12:52:47 +00:00
|
|
|
ffmpeg \
|
2021-02-15 11:08:04 +00:00
|
|
|
ffmpegthumbnailer \
|
|
|
|
libavcodec-extra \
|
2020-08-13 13:10:50 +00:00
|
|
|
lsof \
|
2020-08-25 12:57:45 +00:00
|
|
|
apache2-utils \
|
2020-10-20 10:47:04 +00:00
|
|
|
fonts-roboto \
|
2021-06-02 09:04:31 +00:00
|
|
|
sudo && \
|
2021-07-15 14:05:50 +00:00
|
|
|
[ "$TARGETARCH" = "arm" ] || apt-get -qq install darktable; \
|
|
|
|
apt-get -y autoremove && apt-get -y autoclean && apt-get clean
|
2021-06-02 09:04:31 +00:00
|
|
|
|
|
|
|
# Set environment variables
|
|
|
|
ENV LD_LIBRARY_PATH="/root/.local/lib:/usr/local/lib:/usr/lib:/lib" \
|
|
|
|
TF_CPP_MIN_LOG_LEVEL="0" \
|
|
|
|
NODE_ENV="production" \
|
|
|
|
GOPATH="/go" \
|
|
|
|
GOBIN="/go/bin" \
|
|
|
|
PATH="/go/bin:/usr/local/go/bin:~/.local/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
|
|
|
|
GO111MODULE="on" \
|
|
|
|
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
|
2018-11-08 09:56:11 +00:00
|
|
|
|
2020-04-22 08:27:02 +00:00
|
|
|
# Install & configure TensorFlow for C,
|
|
|
|
# see https://www.tensorflow.org/install/lang_c
|
2019-07-15 18:41:27 +00:00
|
|
|
#
|
2020-04-22 08:27:02 +00:00
|
|
|
# We also have custom builds available:
|
2019-07-15 18:41:27 +00:00
|
|
|
# https://dl.photoprism.org/tensorflow/linux/
|
|
|
|
#
|
2021-06-02 09:04:31 +00:00
|
|
|
RUN /root/.local/bin/install-tensorflow.sh $TARGETARCH
|
2018-11-08 09:56:11 +00:00
|
|
|
|
2019-05-07 13:41:33 +00:00
|
|
|
# Install NodeJS
|
2020-07-15 00:13:03 +00:00
|
|
|
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
|
2021-02-15 11:08:04 +00:00
|
|
|
RUN add-apt-repository -y ppa:saiarcot895/chromium-beta && \
|
|
|
|
apt-get update && \
|
2021-07-15 14:05:50 +00:00
|
|
|
apt-get -qq install chromium-browser chromium-codecs-ffmpeg-extra nodejs && \
|
|
|
|
apt-get -y autoremove && \
|
|
|
|
apt-get -y autoclean && \
|
2018-11-08 09:56:11 +00:00
|
|
|
apt-get clean && \
|
2021-07-15 14:05:50 +00:00
|
|
|
rm -rf /var/lib/apt/lists/*
|
2019-05-07 13:41:33 +00:00
|
|
|
|
2021-05-15 12:05:52 +00:00
|
|
|
# Install NodeJS & NPM
|
2021-07-15 14:05:50 +00:00
|
|
|
RUN umask 0000 && npm install --unsafe-perm=true --allow-root -g npm && npm config set cache ~/.cache/npm && \
|
|
|
|
[ "$TARGETARCH" = "arm" ] || npm install --unsafe-perm=true --allow-root -g testcafe chromedriver;
|
|
|
|
|
2018-11-08 09:56:11 +00:00
|
|
|
|
2018-11-09 09:56:52 +00:00
|
|
|
# Install Go
|
2021-08-05 09:09:26 +00:00
|
|
|
RUN /root/.local/bin/install-go.sh ${TARGETARCH} && \
|
|
|
|
mkdir -p "/go/src" "/go/bin" && \
|
|
|
|
chmod -R 777 "/go"
|
2018-11-08 09:56:11 +00:00
|
|
|
|
2018-11-08 15:41:14 +00:00
|
|
|
# Download TensorFlow model and test files
|
2020-10-04 09:23:01 +00:00
|
|
|
RUN rm -rf /tmp/* && mkdir -p /tmp/photoprism && \
|
|
|
|
wget "https://dl.photoprism.org/tensorflow/nsfw.zip?${BUILD_TAG}" -O /tmp/photoprism/nsfw.zip && \
|
|
|
|
wget "https://dl.photoprism.org/tensorflow/nasnet.zip?${BUILD_TAG}" -O /tmp/photoprism/nasnet.zip && \
|
2021-07-16 13:17:27 +00:00
|
|
|
wget "https://dl.photoprism.org/tensorflow/facenet.zip?${BUILD_TAG}" -O /tmp/photoprism/facenet.zip && \
|
2021-01-02 03:14:16 +00:00
|
|
|
wget "https://dl.photoprism.org/qa/testdata.zip?${BUILD_TAG}" -O /tmp/photoprism/testdata.zip
|
2018-11-08 15:41:14 +00:00
|
|
|
|
2021-02-22 20:09:50 +00:00
|
|
|
# Install additional tools
|
|
|
|
COPY --chown=root:root --chmod=755 /docker/scripts/heif-convert.sh /usr/local/bin/heif-convert
|
2021-07-16 13:42:51 +00:00
|
|
|
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 && \
|
2021-07-16 13:26:56 +00:00
|
|
|
[ "$TARGETARCH" = "arm" ] || \
|
2021-07-16 13:42:51 +00:00
|
|
|
env GO111MODULE=off /usr/local/go/bin/go get -u github.com/psampaz/go-mod-outdated \
|
|
|
|
github.com/tsliwowicz/go-wrk github.com/dsoprea/go-exif/v3/command/exif-read-tool; \
|
2021-02-05 16:39:48 +00:00
|
|
|
echo "alias go=richgo" > /root/.bash_aliases && \
|
|
|
|
cp /go/bin/gosu /bin/gosu
|
2020-10-04 09:23:01 +00:00
|
|
|
|
|
|
|
# Create photoprism user and directory for deployment
|
2021-09-28 16:51:23 +00:00
|
|
|
RUN useradd photoprism -m -U -u 1000 -d /photoprism && chmod a+rwx /photoprism && \
|
2021-05-20 07:15:40 +00:00
|
|
|
mkdir -m 777 -p /var/lib/photoprism /tmp/photoprism && \
|
2020-10-04 09:23:01 +00:00
|
|
|
echo "alias go=richgo" > /photoprism/.bash_aliases && \
|
2020-10-20 10:47:04 +00:00
|
|
|
echo "photoprism ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
|
2021-01-17 10:56:28 +00:00
|
|
|
chown -Rf photoprism:photoprism /photoprism /var/lib/photoprism /tmp/photoprism && \
|
|
|
|
chmod -Rf a+rw /photoprism /var/lib/photoprism /tmp/photoprism /go && \
|
2020-12-04 10:02:19 +00:00
|
|
|
find /go -type d -print0 | xargs -0 chmod 777
|
2020-10-04 09:23:01 +00:00
|
|
|
|
|
|
|
# Copy mysql client config for development
|
|
|
|
COPY --chown=root:root /docker/development/.my.cnf /root/.my.cnf
|
|
|
|
COPY --chown=photoprism:photoprism /docker/development/.my.cnf /photoprism/.my.cnf
|
|
|
|
RUN chmod 644 /root/.my.cnf /photoprism/.my.cnf
|
2020-05-09 09:00:22 +00:00
|
|
|
|
2018-11-08 19:29:16 +00:00
|
|
|
# Set up project directory
|
|
|
|
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
|
|
|
|
2020-08-12 08:25:50 +00:00
|
|
|
# Expose HTTP port 2342, 2343 plus 9515 for chromedriver
|
|
|
|
EXPOSE 2342 2343 9515
|
2020-12-04 10:38:12 +00:00
|
|
|
VOLUME /var/lib/photoprism
|
2018-11-08 09:56:11 +00:00
|
|
|
|
2021-01-15 14:02:06 +00:00
|
|
|
# Configure entrypoint
|
2021-06-02 09:04:31 +00:00
|
|
|
COPY --chown=root:root --chmod=755 /docker/development/entrypoint.sh /entrypoint.sh
|
2021-01-15 14:02:06 +00:00
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
|
|
|
|
# Run server
|
|
|
|
CMD ["tail", "-f", "/dev/null"]
|