2021-10-21 16:53:04 +02:00
|
|
|
FROM ubuntu:21.10
|
2018-11-08 10:56:11 +01:00
|
|
|
|
2021-12-12 20:14:07 +01:00
|
|
|
LABEL maintainer="Michael Mayer <hello@photoprism.app>"
|
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/
|
|
|
|
|
2022-02-15 18:23:59 +01:00
|
|
|
# update image and install build dependencies
|
2022-02-02 17:57:58 +01:00
|
|
|
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
|
2022-02-15 18:23:59 +01:00
|
|
|
apt-utils \
|
|
|
|
gpg-agent \
|
2021-02-26 11:06:20 +01:00
|
|
|
ca-certificates \
|
2022-02-15 18:23:59 +01:00
|
|
|
build-essential \
|
|
|
|
bash \
|
|
|
|
make \
|
|
|
|
nano \
|
2021-02-26 11:06:20 +01:00
|
|
|
wget \
|
2018-11-12 06:58:39 +01:00
|
|
|
curl \
|
2022-02-15 18:23:59 +01:00
|
|
|
git \
|
|
|
|
gettext \
|
|
|
|
mariadb-client \
|
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 \
|
2020-12-11 10:30:04 +01:00
|
|
|
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; \
|
2022-02-15 18:47:09 +01:00
|
|
|
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
|
2022-02-15 18:23:59 +01:00
|
|
|
apt-get update && apt-get -qq install nodejs && \
|
|
|
|
npm install --unsafe-perm=true --allow-root -g npm && \
|
|
|
|
npm config set cache ~/.cache/npm && \
|
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
|
|
|
|
2022-02-15 18:23:59 +01:00
|
|
|
# download TensorFlow models & example files for testing
|
2020-10-04 11:23:01 +02:00
|
|
|
RUN rm -rf /tmp/* && mkdir -p /tmp/photoprism && \
|
2021-12-12 20:15:52 +01:00
|
|
|
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
|
2018-11-08 16:41:14 +01:00
|
|
|
|
2022-02-15 18:23:59 +01: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
|
2022-01-06 11:31:37 +01:00
|
|
|
COPY --chown=root:root /docker/develop/entrypoint.sh /entrypoint.sh
|
2021-09-29 09:01:57 +02:00
|
|
|
|
2022-02-15 18:23:59 +01: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
|
|
|
|
2022-02-15 18:23:59 +01: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
|
|
|
|
2022-02-15 18:23:59 +01:00
|
|
|
# copy mysql client config for develop
|
2022-01-06 11:31:37 +01:00
|
|
|
COPY --chown=root:root /docker/develop/.my.cnf /root/.my.cnf
|
|
|
|
COPY --chown=photoprism:photoprism /docker/develop/.my.cnf /photoprism/.my.cnf
|
2020-10-04 11:23:01 +02:00
|
|
|
RUN chmod 644 /root/.my.cnf /photoprism/.my.cnf
|
2020-05-09 11:00:22 +02:00
|
|
|
|
2022-02-15 18:23:59 +01:00
|
|
|
# set up project directory
|
2018-11-08 20:29:16 +01:00
|
|
|
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
|
|
|
|
2022-02-15 18:23:59 +01:00
|
|
|
# expose HTTP ports: 2342 (HTTP), 2343 (Acceptance Tests), 9515 (Chromedriver), 40000 (Go)
|
|
|
|
EXPOSE 2342 2343 9515 40000
|
2020-12-04 11:38:12 +01:00
|
|
|
VOLUME /var/lib/photoprism
|
2018-11-08 10:56:11 +01:00
|
|
|
|
2022-02-15 18:23:59 +01:00
|
|
|
# configure entrypoint
|
2021-01-15 15:02:06 +01:00
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
|
2022-02-15 18:23:59 +01:00
|
|
|
# keep container running
|
2021-01-15 15:02:06 +01:00
|
|
|
CMD ["tail", "-f", "/dev/null"]
|