2021-10-21 16:53:04 +02:00
|
|
|
FROM ubuntu:21.10
|
2018-11-08 10:56:11 +01:00
|
|
|
|
2021-05-16 16:08:49 +02:00
|
|
|
LABEL maintainer="Michael Mayer <hello@photoprism.org>"
|
2018-11-08 10:56:11 +01:00
|
|
|
|
2021-06-02 11:04:31 +02:00
|
|
|
ARG TARGETARCH
|
|
|
|
ARG TARGETPLATFORM
|
2019-05-16 08:41:16 +02:00
|
|
|
ARG BUILD_TAG
|
2021-12-09 18:48:44 +01:00
|
|
|
ARG GOPROXY
|
2021-12-10 10:17:13 +01:00
|
|
|
ARG GODEBUG
|
2019-05-16 08:41:16 +02:00
|
|
|
|
2021-05-15 14:05:52 +02:00
|
|
|
# Set environment variables
|
|
|
|
ENV DEBIAN_FRONTEND="noninteractive" \
|
2021-10-22 14:18:17 +02:00
|
|
|
TMPDIR="/tmp" \
|
|
|
|
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-12 06:58:39 +01:00
|
|
|
|
2021-02-15 12:08:04 +01:00
|
|
|
# Configure apt
|
2020-08-12 10:25:50 +02: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 21:36:37 +02:00
|
|
|
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
|
2018-11-12 06:58:39 +01:00
|
|
|
|
2021-06-02 11:04:31 +02:00
|
|
|
# Copy scripts to /root/.local/bin
|
|
|
|
COPY --chown=root:root --chmod=755 /docker/scripts/*.sh /root/.local/bin/
|
|
|
|
|
2021-10-22 14:18:17 +02:00
|
|
|
# 1. Install distribution packages
|
|
|
|
# 2. Install TensorFlow for C
|
|
|
|
# 3. Install Chrome, NodeJS, NPM, Puppeteer, TestCafe & ChromeDriver
|
|
|
|
# 4. Install Go
|
2021-09-29 09:01:57 +02:00
|
|
|
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
|
2018-11-12 06:58:39 +01:00
|
|
|
build-essential \
|
2021-02-26 11:06:20 +01:00
|
|
|
ca-certificates \
|
|
|
|
wget \
|
2018-11-12 06:58:39 +01:00
|
|
|
curl \
|
2021-02-26 11:06:20 +01:00
|
|
|
davfs2 \
|
2019-05-07 15:41:33 +02:00
|
|
|
chrpath \
|
|
|
|
libssl-dev \
|
|
|
|
libxft-dev \
|
|
|
|
libfreetype6 \
|
2018-11-12 06:58:39 +01:00
|
|
|
libfreetype6-dev \
|
2019-05-07 15:41:33 +02:00
|
|
|
libfontconfig1 \
|
|
|
|
libfontconfig1-dev \
|
2018-11-12 06:58:39 +01:00
|
|
|
libhdf5-serial-dev \
|
|
|
|
libpng-dev \
|
|
|
|
libzmq3-dev \
|
2020-08-25 14:57:45 +02:00
|
|
|
libx264-dev \
|
|
|
|
libx265-dev \
|
2021-10-21 18:36:04 +02:00
|
|
|
libnss3 \
|
|
|
|
libxtst6 \
|
2021-11-29 14:39:21 +01:00
|
|
|
librsvg2-bin \
|
2018-11-12 06:58:39 +01:00
|
|
|
pkg-config \
|
|
|
|
software-properties-common \
|
|
|
|
rsync \
|
|
|
|
unzip \
|
2019-06-06 14:44:29 +02:00
|
|
|
zip \
|
2018-11-12 06:58:39 +01:00
|
|
|
g++ \
|
|
|
|
gcc \
|
|
|
|
libc6-dev \
|
|
|
|
gpg-agent \
|
|
|
|
apt-utils \
|
|
|
|
make \
|
|
|
|
nano \
|
|
|
|
git \
|
2020-07-15 01:26:54 +02:00
|
|
|
gettext \
|
2020-12-11 10:30:04 +01:00
|
|
|
mariadb-client \
|
|
|
|
sqlite3 \
|
2019-05-07 15:41:33 +02:00
|
|
|
tzdata \
|
2019-05-09 06:18:22 +02:00
|
|
|
gconf-service \
|
2019-06-06 14:44:29 +02:00
|
|
|
firefox \
|
|
|
|
libheif-examples \
|
2020-02-03 23:40:45 +01:00
|
|
|
exiftool \
|
2020-08-12 10:42:19 +02:00
|
|
|
rawtherapee \
|
2020-05-30 14:52:47 +02:00
|
|
|
ffmpeg \
|
2021-02-15 12:08:04 +01:00
|
|
|
ffmpegthumbnailer \
|
|
|
|
libavcodec-extra \
|
2020-08-13 15:10:50 +02:00
|
|
|
lsof \
|
2020-08-25 14:57:45 +02:00
|
|
|
apache2-utils \
|
2020-10-20 12:47:04 +02:00
|
|
|
fonts-roboto \
|
2021-06-02 11:04:31 +02:00
|
|
|
sudo && \
|
2021-07-15 16:05:50 +02:00
|
|
|
[ "$TARGETARCH" = "arm" ] || apt-get -qq install darktable; \
|
2021-10-22 14:18:17 +02:00
|
|
|
/root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \
|
|
|
|
/root/.local/bin/install-devtools.sh ${TARGETARCH} && \
|
|
|
|
/root/.local/bin/install-go.sh ${TARGETARCH} && \
|
2021-08-05 11:09:26 +02:00
|
|
|
mkdir -p "/go/src" "/go/bin" && \
|
|
|
|
chmod -R 777 "/go"
|
2018-11-08 10:56:11 +01:00
|
|
|
|
2021-10-21 18:36:04 +02:00
|
|
|
# Download TensorFlow models & example files for testing
|
2020-10-04 11:23:01 +02: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 15:17:27 +02:00
|
|
|
wget "https://dl.photoprism.org/tensorflow/facenet.zip?${BUILD_TAG}" -O /tmp/photoprism/facenet.zip && \
|
2021-01-02 04:14:16 +01:00
|
|
|
wget "https://dl.photoprism.org/qa/testdata.zip?${BUILD_TAG}" -O /tmp/photoprism/testdata.zip
|
2018-11-08 16:41:14 +01:00
|
|
|
|
2021-10-21 18:36:04 +02:00
|
|
|
# Copy additional scripts to image
|
2021-09-29 09:01:57 +02:00
|
|
|
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
|
|
|
|
|
2021-10-21 18:36:04 +02:00
|
|
|
# Install Go tools
|
2021-10-21 16:44:40 +02:00
|
|
|
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 && \
|
2021-07-16 15:26:56 +02:00
|
|
|
[ "$TARGETARCH" = "arm" ] || \
|
2021-10-21 16:44:40 +02:00
|
|
|
/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; \
|
2021-02-05 17:39:48 +01:00
|
|
|
echo "alias go=richgo" > /root/.bash_aliases && \
|
|
|
|
cp /go/bin/gosu /bin/gosu
|
2020-10-04 11:23:01 +02:00
|
|
|
|
|
|
|
# Create photoprism user and directory for deployment
|
2021-09-29 09:27:09 +02:00
|
|
|
RUN useradd -m -U -u 1000 -d /photoprism photoprism && chmod a+rwx /photoprism && \
|
2021-05-20 09:15:40 +02:00
|
|
|
mkdir -m 777 -p /var/lib/photoprism /tmp/photoprism && \
|
2020-10-04 11:23:01 +02:00
|
|
|
echo "alias go=richgo" > /photoprism/.bash_aliases && \
|
2020-10-20 12:47:04 +02:00
|
|
|
echo "photoprism ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
|
2021-01-17 11:56:28 +01:00
|
|
|
chown -Rf photoprism:photoprism /photoprism /var/lib/photoprism /tmp/photoprism && \
|
|
|
|
chmod -Rf a+rw /photoprism /var/lib/photoprism /tmp/photoprism /go && \
|
2021-09-29 09:01:57 +02:00
|
|
|
chmod 755 /usr/local/bin/heif-convert /entrypoint.sh && \
|
2020-12-04 11:02:19 +01:00
|
|
|
find /go -type d -print0 | xargs -0 chmod 777
|
2020-10-04 11:23:01 +02: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 11:00:22 +02:00
|
|
|
|
2018-11-08 20:29:16 +01:00
|
|
|
# Set up project directory
|
|
|
|
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
|
|
|
|
2020-08-12 10:25:50 +02:00
|
|
|
# Expose HTTP port 2342, 2343 plus 9515 for chromedriver
|
|
|
|
EXPOSE 2342 2343 9515
|
2020-12-04 11:38:12 +01:00
|
|
|
VOLUME /var/lib/photoprism
|
2018-11-08 10:56:11 +01:00
|
|
|
|
2021-01-15 15:02:06 +01:00
|
|
|
# Configure entrypoint
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
|
|
|
|
# Run server
|
|
|
|
CMD ["tail", "-f", "/dev/null"]
|