Develop: Add Debian Docker base images (experimental)
This commit is contained in:
parent
daedf0ee63
commit
211317ccff
9 changed files with 379 additions and 81 deletions
32
Makefile
32
Makefile
|
@ -205,34 +205,42 @@ clean:
|
|||
docker-develop:
|
||||
docker pull --platform=amd64 ubuntu:21.10
|
||||
docker pull --platform=arm64 ubuntu:21.10
|
||||
scripts/docker/multiarch.sh develop linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
docker-develop-buster:
|
||||
docker pull --platform=amd64 golang:buster
|
||||
docker pull --platform=arm64 golang:buster
|
||||
scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 buster /buster
|
||||
docker-develop-bullseye:
|
||||
docker pull --platform=amd64 golang:bullseye
|
||||
docker pull --platform=arm64 golang:bullseye
|
||||
scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 bullseye /bullseye
|
||||
docker-preview:
|
||||
scripts/docker/multiarch.sh photoprism linux/amd64,linux/arm64
|
||||
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64
|
||||
docker-release:
|
||||
scripts/docker/multiarch.sh photoprism linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
docker-arm64-preview:
|
||||
scripts/docker/arch.sh photoprism linux/arm64 arm64-preview
|
||||
scripts/docker/buildx.sh photoprism linux/arm64 arm64-preview
|
||||
docker-arm64-release:
|
||||
scripts/docker/arch.sh photoprism linux/arm64 arm64
|
||||
scripts/docker/buildx.sh photoprism linux/arm64 arm64
|
||||
docker-armv7-develop:
|
||||
docker pull --platform=arm ubuntu:21.10
|
||||
scripts/docker/arch.sh develop linux/arm armv7 /armv7
|
||||
scripts/docker/buildx.sh develop linux/arm armv7 /armv7
|
||||
docker-armv7-preview:
|
||||
docker pull --platform=arm photoprism/develop:armv7
|
||||
scripts/docker/arch.sh photoprism linux/arm armv7-preview /armv7
|
||||
scripts/docker/buildx.sh photoprism linux/arm armv7-preview /armv7
|
||||
docker-armv7-release:
|
||||
docker pull --platform=arm photoprism/develop:armv7
|
||||
scripts/docker/arch.sh photoprism linux/arm armv7 /armv7
|
||||
scripts/docker/buildx.sh photoprism linux/arm armv7 /armv7
|
||||
docker-local:
|
||||
scripts/docker/build.sh photoprism
|
||||
docker-pull:
|
||||
docker pull photoprism/photoprism:preview photoprism/photoprism:latest
|
||||
docker-ddns:
|
||||
docker pull golang:alpine
|
||||
scripts/docker/multiarch.sh ddns linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
scripts/docker/buildx-multi.sh ddns linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
docker-goproxy:
|
||||
docker pull golang:alpine
|
||||
scripts/docker/multiarch.sh goproxy linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
scripts/docker/buildx-multi.sh goproxy linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
docker-demo:
|
||||
scripts/docker/build.sh demo $(DOCKER_TAG)
|
||||
scripts/docker/push.sh demo $(DOCKER_TAG)
|
||||
|
@ -243,11 +251,11 @@ docker-demo-local:
|
|||
docker-dummy-webdav:
|
||||
docker pull --platform=amd64 golang:1
|
||||
docker pull --platform=arm64 golang:1
|
||||
scripts/docker/multiarch.sh dummy-webdav linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
scripts/docker/buildx-multi.sh dummy-webdav linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
docker-dummy-oidc:
|
||||
docker pull --platform=amd64 golang:1
|
||||
docker pull --platform=arm64 golang:1
|
||||
scripts/docker/multiarch.sh dummy-oidc linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
scripts/docker/buildx-multi.sh dummy-oidc linux/amd64,linux/arm64 $(DOCKER_TAG)
|
||||
packer-digitalocean:
|
||||
$(info Buildinng DigitalOcean marketplace image...)
|
||||
(cd ./docker/examples/cloud && packer build digitalocean.json)
|
||||
|
|
|
@ -30,15 +30,20 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
|
|||
# Copy scripts to /root/.local/bin
|
||||
COPY --chown=root:root --chmod=755 /docker/scripts/*.sh /root/.local/bin/
|
||||
|
||||
# 1. Install distribution packages
|
||||
# 2. Install TensorFlow for C
|
||||
# 3. Install Chrome, NodeJS, NPM, Puppeteer, TestCafe & ChromeDriver
|
||||
# 4. Install Go
|
||||
# update image and install build dependencies
|
||||
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
|
||||
build-essential \
|
||||
apt-utils \
|
||||
gpg-agent \
|
||||
ca-certificates \
|
||||
build-essential \
|
||||
bash \
|
||||
make \
|
||||
nano \
|
||||
wget \
|
||||
curl \
|
||||
git \
|
||||
gettext \
|
||||
mariadb-client \
|
||||
davfs2 \
|
||||
chrpath \
|
||||
libssl-dev \
|
||||
|
@ -63,13 +68,6 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta
|
|||
g++ \
|
||||
gcc \
|
||||
libc6-dev \
|
||||
gpg-agent \
|
||||
apt-utils \
|
||||
make \
|
||||
nano \
|
||||
git \
|
||||
gettext \
|
||||
mariadb-client \
|
||||
sqlite3 \
|
||||
tzdata \
|
||||
gconf-service \
|
||||
|
@ -85,25 +83,29 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta
|
|||
fonts-roboto \
|
||||
sudo && \
|
||||
[ "$TARGETARCH" = "arm" ] || apt-get -qq install darktable; \
|
||||
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
||||
apt-get update && apt-get -qq install nodejs && \
|
||||
npm install --unsafe-perm=true --allow-root -g npm && \
|
||||
npm config set cache ~/.cache/npm && \
|
||||
/root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \
|
||||
/root/.local/bin/install-devtools.sh ${TARGETARCH} && \
|
||||
/root/.local/bin/install-go.sh ${TARGETARCH} && \
|
||||
mkdir -p "/go/src" "/go/bin" && \
|
||||
chmod -R 777 "/go"
|
||||
|
||||
# Download TensorFlow models & example files for testing
|
||||
# download TensorFlow models & example files for testing
|
||||
RUN rm -rf /tmp/* && mkdir -p /tmp/photoprism && \
|
||||
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
|
||||
|
||||
# Copy additional scripts to image
|
||||
# copy additional scripts to image
|
||||
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/develop/entrypoint.sh /entrypoint.sh
|
||||
|
||||
# Install Go tools
|
||||
# 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 && \
|
||||
|
@ -113,7 +115,7 @@ RUN /usr/local/go/bin/go install github.com/tianon/gosu@latest && \
|
|||
echo "alias go=richgo" > /root/.bash_aliases && \
|
||||
cp /go/bin/gosu /bin/gosu
|
||||
|
||||
# Create photoprism user and directory for deployment
|
||||
# create photoprism user and directory for deployment
|
||||
RUN useradd -m -U -u 1000 -d /photoprism photoprism && chmod a+rwx /photoprism && \
|
||||
mkdir -m 777 -p /var/lib/photoprism /tmp/photoprism && \
|
||||
echo "alias go=richgo" > /photoprism/.bash_aliases && \
|
||||
|
@ -123,20 +125,20 @@ RUN useradd -m -U -u 1000 -d /photoprism photoprism && chmod a+rwx /photoprism &
|
|||
chmod 755 /usr/local/bin/heif-convert /entrypoint.sh && \
|
||||
find /go -type d -print0 | xargs -0 chmod 777
|
||||
|
||||
# Copy mysql client config for develop
|
||||
# copy mysql client config for develop
|
||||
COPY --chown=root:root /docker/develop/.my.cnf /root/.my.cnf
|
||||
COPY --chown=photoprism:photoprism /docker/develop/.my.cnf /photoprism/.my.cnf
|
||||
RUN chmod 644 /root/.my.cnf /photoprism/.my.cnf
|
||||
|
||||
# Set up project directory
|
||||
# set up project directory
|
||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||
|
||||
# Expose HTTP port 2342, 2343 plus 9515 for chromedriver
|
||||
EXPOSE 2342 2343 9515
|
||||
# expose HTTP ports: 2342 (HTTP), 2343 (Acceptance Tests), 9515 (Chromedriver), 40000 (Go)
|
||||
EXPOSE 2342 2343 9515 40000
|
||||
VOLUME /var/lib/photoprism
|
||||
|
||||
# Configure entrypoint
|
||||
# configure entrypoint
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# Run server
|
||||
# keep container running
|
||||
CMD ["tail", "-f", "/dev/null"]
|
141
docker/develop/bullseye/Dockerfile
Normal file
141
docker/develop/bullseye/Dockerfile
Normal file
|
@ -0,0 +1,141 @@
|
|||
FROM golang:bullseye
|
||||
|
||||
LABEL maintainer="Michael Mayer <hello@photoprism.app>"
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILD_TAG
|
||||
ARG GOPROXY
|
||||
ARG GODEBUG
|
||||
|
||||
# set environment variables
|
||||
ENV DEBIAN_FRONTEND="noninteractive" \
|
||||
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"
|
||||
|
||||
# configure apt
|
||||
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 && \
|
||||
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
|
||||
|
||||
# copy scripts to /root/.local/bin
|
||||
COPY --chown=root:root --chmod=755 /docker/scripts/*.sh /root/.local/bin/
|
||||
|
||||
# update image and install build dependencies
|
||||
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
|
||||
apt-utils \
|
||||
gpg-agent \
|
||||
pkg-config \
|
||||
software-properties-common \
|
||||
ca-certificates \
|
||||
build-essential \
|
||||
gcc \
|
||||
g++ \
|
||||
sudo \
|
||||
bash \
|
||||
make \
|
||||
nano \
|
||||
wget \
|
||||
curl \
|
||||
rsync \
|
||||
unzip \
|
||||
zip \
|
||||
git \
|
||||
gettext \
|
||||
chromium \
|
||||
chromium \
|
||||
chromium-driver \
|
||||
mariadb-client \
|
||||
sqlite3 \
|
||||
libc6-dev \
|
||||
libssl-dev \
|
||||
libxft-dev \
|
||||
libhdf5-serial-dev \
|
||||
libpng-dev \
|
||||
libheif-examples \
|
||||
librsvg2-bin \
|
||||
libzmq3-dev \
|
||||
libx264-dev \
|
||||
libx265-dev \
|
||||
libnss3 \
|
||||
libfreetype6 \
|
||||
libfreetype6-dev \
|
||||
libfontconfig1 \
|
||||
libfontconfig1-dev \
|
||||
fonts-roboto \
|
||||
tzdata \
|
||||
exiftool \
|
||||
darktable \
|
||||
rawtherapee \
|
||||
ffmpeg \
|
||||
ffmpegthumbnailer \
|
||||
libavcodec-extra \
|
||||
davfs2 \
|
||||
chrpath \
|
||||
lsof \
|
||||
apache2-utils && \
|
||||
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
||||
apt-get update && apt-get -qq install nodejs && \
|
||||
npm install --unsafe-perm=true --allow-root -g npm && \
|
||||
npm config set cache ~/.cache/npm && \
|
||||
apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/* && \
|
||||
/root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \
|
||||
mkdir -p "/go/src" "/go/bin" && \
|
||||
chmod -R 777 "/go"
|
||||
|
||||
# download TensorFlow models & example files for testing
|
||||
RUN rm -rf /tmp/* && mkdir -p /tmp/photoprism && \
|
||||
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
|
||||
|
||||
# copy additional scripts to image
|
||||
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/develop/entrypoint.sh /entrypoint.sh
|
||||
|
||||
# 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; \
|
||||
echo "alias go=richgo" > /root/.bash_aliases && \
|
||||
cp /go/bin/gosu /bin/gosu
|
||||
|
||||
# create photoprism user and directory for deployment
|
||||
RUN useradd -m -U -u 1000 -d /photoprism photoprism && chmod a+rwx /photoprism && \
|
||||
mkdir -m 777 -p /var/lib/photoprism /tmp/photoprism && \
|
||||
echo "alias go=richgo" > /photoprism/.bash_aliases && \
|
||||
echo "photoprism ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
|
||||
chown -Rf photoprism:photoprism /photoprism /var/lib/photoprism /tmp/photoprism && \
|
||||
chmod -Rf a+rw /photoprism /var/lib/photoprism /tmp/photoprism /go && \
|
||||
chmod 755 /usr/local/bin/heif-convert /entrypoint.sh && \
|
||||
find /go -type d -print0 | xargs -0 chmod 777
|
||||
|
||||
# copy mysql client config for develop
|
||||
COPY --chown=root:root /docker/develop/.my.cnf /root/.my.cnf
|
||||
COPY --chown=photoprism:photoprism /docker/develop/.my.cnf /photoprism/.my.cnf
|
||||
RUN chmod 644 /root/.my.cnf /photoprism/.my.cnf
|
||||
|
||||
# set up project directory
|
||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||
|
||||
# expose HTTP ports: 2342 (HTTP), 2343 (Acceptance Tests), 9515 (Chromedriver), 40000 (Go)
|
||||
EXPOSE 2342 2343 9515 40000
|
||||
|
||||
# configure entrypoint
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# keep container running
|
||||
CMD ["tail", "-f", "/dev/null"]
|
141
docker/develop/buster/Dockerfile
Normal file
141
docker/develop/buster/Dockerfile
Normal file
|
@ -0,0 +1,141 @@
|
|||
FROM golang:buster
|
||||
|
||||
LABEL maintainer="Michael Mayer <hello@photoprism.app>"
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILD_TAG
|
||||
ARG GOPROXY
|
||||
ARG GODEBUG
|
||||
|
||||
# set environment variables
|
||||
ENV DEBIAN_FRONTEND="noninteractive" \
|
||||
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"
|
||||
|
||||
# configure apt
|
||||
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 && \
|
||||
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
|
||||
|
||||
# copy scripts to /root/.local/bin
|
||||
COPY --chown=root:root --chmod=755 /docker/scripts/*.sh /root/.local/bin/
|
||||
|
||||
# update image and install build dependencies
|
||||
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
|
||||
apt-utils \
|
||||
gpg-agent \
|
||||
pkg-config \
|
||||
software-properties-common \
|
||||
ca-certificates \
|
||||
build-essential \
|
||||
gcc \
|
||||
g++ \
|
||||
sudo \
|
||||
bash \
|
||||
make \
|
||||
nano \
|
||||
wget \
|
||||
curl \
|
||||
rsync \
|
||||
unzip \
|
||||
zip \
|
||||
git \
|
||||
gettext \
|
||||
chromium \
|
||||
chromium \
|
||||
chromium-driver \
|
||||
mariadb-client \
|
||||
sqlite3 \
|
||||
libc6-dev \
|
||||
libssl-dev \
|
||||
libxft-dev \
|
||||
libhdf5-serial-dev \
|
||||
libpng-dev \
|
||||
libheif-examples \
|
||||
librsvg2-bin \
|
||||
libzmq3-dev \
|
||||
libx264-dev \
|
||||
libx265-dev \
|
||||
libnss3 \
|
||||
libfreetype6 \
|
||||
libfreetype6-dev \
|
||||
libfontconfig1 \
|
||||
libfontconfig1-dev \
|
||||
fonts-roboto \
|
||||
tzdata \
|
||||
exiftool \
|
||||
darktable \
|
||||
rawtherapee \
|
||||
ffmpeg \
|
||||
ffmpegthumbnailer \
|
||||
libavcodec-extra \
|
||||
davfs2 \
|
||||
chrpath \
|
||||
lsof \
|
||||
apache2-utils && \
|
||||
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
||||
apt-get update && apt-get -qq install nodejs && \
|
||||
npm install --unsafe-perm=true --allow-root -g npm && \
|
||||
npm config set cache ~/.cache/npm && \
|
||||
apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/* && \
|
||||
/root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \
|
||||
mkdir -p "/go/src" "/go/bin" && \
|
||||
chmod -R 777 "/go"
|
||||
|
||||
# download TensorFlow models & example files for testing
|
||||
RUN rm -rf /tmp/* && mkdir -p /tmp/photoprism && \
|
||||
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
|
||||
|
||||
# copy additional scripts to image
|
||||
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/develop/entrypoint.sh /entrypoint.sh
|
||||
|
||||
# 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; \
|
||||
echo "alias go=richgo" > /root/.bash_aliases && \
|
||||
cp /go/bin/gosu /bin/gosu
|
||||
|
||||
# create photoprism user and directory for deployment
|
||||
RUN useradd -m -U -u 1000 -d /photoprism photoprism && chmod a+rwx /photoprism && \
|
||||
mkdir -m 777 -p /var/lib/photoprism /tmp/photoprism && \
|
||||
echo "alias go=richgo" > /photoprism/.bash_aliases && \
|
||||
echo "photoprism ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
|
||||
chown -Rf photoprism:photoprism /photoprism /var/lib/photoprism /tmp/photoprism && \
|
||||
chmod -Rf a+rw /photoprism /var/lib/photoprism /tmp/photoprism /go && \
|
||||
chmod 755 /usr/local/bin/heif-convert /entrypoint.sh && \
|
||||
find /go -type d -print0 | xargs -0 chmod 777
|
||||
|
||||
# copy mysql client config for develop
|
||||
COPY --chown=root:root /docker/develop/.my.cnf /root/.my.cnf
|
||||
COPY --chown=photoprism:photoprism /docker/develop/.my.cnf /photoprism/.my.cnf
|
||||
RUN chmod 644 /root/.my.cnf /photoprism/.my.cnf
|
||||
|
||||
# set up project directory
|
||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||
|
||||
# expose HTTP ports: 2342 (HTTP), 2343 (Acceptance Tests), 9515 (Chromedriver), 40000 (Go)
|
||||
EXPOSE 2342 2343 9515 40000
|
||||
|
||||
# configure entrypoint
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# keep container running
|
||||
CMD ["tail", "-f", "/dev/null"]
|
|
@ -1,10 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ $(id -u) == "0" ]]; then
|
||||
echo "development base image started as root"
|
||||
echo "develop: base image started as root"
|
||||
|
||||
if [ -e /root/.init ]; then
|
||||
echo "initialized"
|
||||
echo "develop: initialized"
|
||||
elif [[ ${PHOTOPRISM_INIT} ]]; then
|
||||
for target in $PHOTOPRISM_INIT; do
|
||||
echo "init ${target}..."
|
||||
|
@ -13,7 +13,7 @@ if [[ $(id -u) == "0" ]]; then
|
|||
echo 1 >/root/.init
|
||||
fi
|
||||
else
|
||||
echo "development base image started as uid $(id -u)"
|
||||
echo "develop: base image started as uid $(id -u)"
|
||||
fi
|
||||
|
||||
re='^[0-9]+$'
|
||||
|
@ -26,7 +26,7 @@ fi
|
|||
|
||||
# Set file permission mask
|
||||
if [[ ${PHOTOPRISM_UMASK} =~ $re ]]; then
|
||||
echo "umask ${PHOTOPRISM_UMASK}"
|
||||
echo "develop: umask ${PHOTOPRISM_UMASK}"
|
||||
umask "${PHOTOPRISM_UMASK}"
|
||||
fi
|
||||
|
||||
|
@ -57,12 +57,12 @@ if [[ $(id -u) == "0" ]]; then
|
|||
usermod -g "${PHOTOPRISM_GID}" "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
|
||||
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]]; then
|
||||
echo "set PHOTOPRISM_DISABLE_CHOWN: \"true\" to disable storage permission updates"
|
||||
echo "updating storage permissions..."
|
||||
echo "develop: set PHOTOPRISM_DISABLE_CHOWN: \"true\" to disable storage permission updates"
|
||||
echo "develop: updating storage permissions..."
|
||||
chown -Rf "${PHOTOPRISM_UID}:${PHOTOPRISM_GID}" /photoprism /var/lib/photoprism /tmp/photoprism /go
|
||||
fi
|
||||
|
||||
echo "running as uid ${PHOTOPRISM_UID}:${PHOTOPRISM_GID}"
|
||||
echo "develop: running as uid ${PHOTOPRISM_UID}:${PHOTOPRISM_GID}"
|
||||
echo "${@}"
|
||||
|
||||
gosu "${PHOTOPRISM_UID}:${PHOTOPRISM_GID}" "$@" &
|
||||
|
@ -72,25 +72,25 @@ if [[ $(id -u) == "0" ]]; then
|
|||
usermod -g 1000 "user_${PHOTOPRISM_UID}" 2>/dev/null
|
||||
|
||||
if [[ -z ${PHOTOPRISM_DISABLE_CHOWN} ]]; then
|
||||
echo "set PHOTOPRISM_DISABLE_CHOWN: \"true\" to disable storage permission updates"
|
||||
echo "updating storage permissions..."
|
||||
echo "develop: set PHOTOPRISM_DISABLE_CHOWN: \"true\" to disable storage permission updates"
|
||||
echo "develop: updating storage permissions..."
|
||||
chown -Rf "${PHOTOPRISM_UID}" /photoprism /var/lib/photoprism /tmp/photoprism /go
|
||||
fi
|
||||
|
||||
echo "running as uid ${PHOTOPRISM_UID}"
|
||||
echo "develop: running as uid ${PHOTOPRISM_UID}"
|
||||
echo "${@}"
|
||||
|
||||
gosu "${PHOTOPRISM_UID}" "$@" &
|
||||
else
|
||||
# Run as root
|
||||
echo "running as root"
|
||||
echo "develop: running as root"
|
||||
echo "${@}"
|
||||
|
||||
"$@" &
|
||||
fi
|
||||
else
|
||||
# Running as user
|
||||
echo "running as uid $(id -u)"
|
||||
echo "develop: running as uid $(id -u)"
|
||||
echo "${@}"
|
||||
|
||||
"$@" &
|
||||
|
|
|
@ -13,14 +13,13 @@ if [[ -z $1 ]]; then
|
|||
else
|
||||
set -eux;
|
||||
umask 0000
|
||||
curl -sL https://deb.nodesource.com/setup_14.x | bash -
|
||||
|
||||
# Install Chrome & NodeJS
|
||||
# Install Chrome or Chromium
|
||||
if [[ $1 == "amd64" ]]; then
|
||||
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
||||
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
|
||||
apt-get update
|
||||
apt-get -qq install google-chrome-stable nodejs
|
||||
apt-get -qq install google-chrome-stable
|
||||
elif [[ $1 == "arm64" ]]; then
|
||||
cat <<EOF > /etc/apt/preferences.d/chromium
|
||||
Package: *
|
||||
|
@ -29,10 +28,7 @@ Pin-Priority: 1002
|
|||
EOF
|
||||
add-apt-repository -y ppa:saiarcot895/chromium-dev
|
||||
apt-get update
|
||||
apt-get -qq install chromium-browser chromium-codecs-ffmpeg-extra nodejs
|
||||
else
|
||||
apt-get update
|
||||
apt-get -qq install nodejs
|
||||
apt-get -qq install chromium-browser chromium-codecs-ffmpeg-extra
|
||||
fi
|
||||
|
||||
# Remove package files
|
||||
|
@ -41,10 +37,6 @@ EOF
|
|||
apt-get -y clean
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install NPM
|
||||
npm install --unsafe-perm=true --allow-root -g npm
|
||||
npm config set cache ~/.cache/npm
|
||||
|
||||
# Install Puppeteer, TestCafe & ChromeDriver
|
||||
if [[ $1 == "amd64" ]]; then
|
||||
npm install --unsafe-perm=true --allow-root -g puppeteer testcafe testcafe-browser-provider-puppeteer chromedriver
|
||||
|
|
|
@ -5,14 +5,16 @@ set -e
|
|||
# see https://docs.docker.com/develop/develop-images/build_enhancements/#to-enable-buildkit-builds
|
||||
export DOCKER_BUILDKIT=1
|
||||
|
||||
if [[ -z $1 ]] || [[ -z $2 ]]; then
|
||||
echo "docker/build: image name required, version is optional" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NUMERIC='^[0-9]+$'
|
||||
GOPROXY=${GOPROXY:-'https://proxy.golang.org,direct'}
|
||||
|
||||
if [[ -z $1 ]] && [[ -z $2 ]]; then
|
||||
echo "Please provide a container image name and version" 1>&2
|
||||
exit 1
|
||||
elif [[ $1 ]] && [[ -z $2 ]]; then
|
||||
echo "Building 'photoprism/$1:preview'...";
|
||||
if [[ $1 ]] && [[ -z $2 ]]; then
|
||||
echo "docker/build: 'photoprism/$1:preview'...";
|
||||
DOCKER_TAG=$(date -u +%Y%m%d)
|
||||
docker build \
|
||||
--no-cache \
|
||||
|
@ -22,9 +24,8 @@ elif [[ $1 ]] && [[ -z $2 ]]; then
|
|||
--build-arg GODEBUG \
|
||||
-t photoprism/$1:preview \
|
||||
-f docker/${1/-//}/Dockerfile .
|
||||
echo "Done"
|
||||
elif [[ $2 =~ $NUMERIC ]]; then
|
||||
echo "Building 'photoprism/$1:$2'...";
|
||||
echo "docker/build: 'photoprism/$1:$2'...";
|
||||
docker build \
|
||||
--no-cache \
|
||||
--pull \
|
||||
|
@ -34,9 +35,8 @@ elif [[ $2 =~ $NUMERIC ]]; then
|
|||
-t photoprism/$1:latest \
|
||||
-t photoprism/$1:$2 \
|
||||
-f docker/${1/-//}/Dockerfile .
|
||||
echo "Done"
|
||||
else
|
||||
echo "Building 'photoprism/$1:$2' in docker/${1/-//}$3/Dockerfile...";
|
||||
echo "docker/build: 'photoprism/$1:$2' from docker/${1/-//}$3/Dockerfile...";
|
||||
DOCKER_TAG=$(date -u +%Y%m%d)
|
||||
docker build $4\
|
||||
--no-cache \
|
||||
|
@ -46,5 +46,6 @@ else
|
|||
--build-arg GODEBUG \
|
||||
-t photoprism/$1:$2 \
|
||||
-f docker/${1/-//}$3/Dockerfile .
|
||||
echo "Done"
|
||||
fi
|
||||
|
||||
echo "docker/build: done"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
export DOCKER_BUILDKIT=1
|
||||
|
||||
if [[ -z $1 ]] || [[ -z $2 ]]; then
|
||||
echo "Please provide the image name, and a list of target architectures e.g. linux/amd64,linux/arm64,linux/arm" 1>&2
|
||||
echo "docker/buildx-multi: image name and architectures required (linux/amd64,linux/arm64,linux/arm)" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -12,7 +12,7 @@ NUMERIC='^[0-9]+$'
|
|||
GOPROXY=${GOPROXY:-'https://proxy.golang.org,direct'}
|
||||
|
||||
# Kill old multibuilder if still alive.
|
||||
echo "Removing existing multibuilder..."
|
||||
echo "docker/buildx-multi: removing existing multibuilder..."
|
||||
docker buildx rm multibuilder 2>/dev/null
|
||||
|
||||
# Wait 5 seconds.
|
||||
|
@ -22,7 +22,7 @@ sleep 5
|
|||
docker buildx create --name multibuilder --use || { echo 'failed'; exit 1; }
|
||||
|
||||
if [[ $1 ]] && [[ $2 ]] && [[ -z $3 ]]; then
|
||||
echo "Building 'photoprism/$1:preview'..."
|
||||
echo "docker/buildx-multi: 'photoprism/$1:preview'..."
|
||||
DOCKER_TAG=$(date -u +%Y%m%d)
|
||||
docker buildx build \
|
||||
--platform $2 \
|
||||
|
@ -35,7 +35,7 @@ if [[ $1 ]] && [[ $2 ]] && [[ -z $3 ]]; then
|
|||
-t photoprism/$1:preview \
|
||||
--push .
|
||||
elif [[ $3 =~ $NUMERIC ]]; then
|
||||
echo "Building 'photoprism/$1:$3'..."
|
||||
echo "docker/buildx-multi: 'photoprism/$1:$3'..."
|
||||
docker buildx build \
|
||||
--platform $2 \
|
||||
--pull \
|
||||
|
@ -47,8 +47,8 @@ elif [[ $3 =~ $NUMERIC ]]; then
|
|||
-t photoprism/$1:latest \
|
||||
-t photoprism/$1:$3 \
|
||||
--push .
|
||||
else
|
||||
echo "Building 'photoprism/$1:$3' in docker/${1/-//}$4/Dockerfile..."
|
||||
elif [[ $4 ]]; then
|
||||
echo "docker/buildx-multi: 'photoprism/$1:$3' from docker/${1/-//}$4/Dockerfile..."
|
||||
DOCKER_TAG=$(date -u +%Y%m%d)
|
||||
docker buildx build \
|
||||
--platform $2 \
|
||||
|
@ -60,9 +60,22 @@ else
|
|||
-f docker/${1/-//}$4/Dockerfile \
|
||||
-t photoprism/$1:$3 \
|
||||
--push .
|
||||
else
|
||||
echo "docker/buildx-multi: 'photoprism/$1:$3' from docker/${1/-//}/Dockerfile..."
|
||||
DOCKER_TAG=$(date -u +%Y%m%d)
|
||||
docker buildx build \
|
||||
--platform $2 \
|
||||
--pull \
|
||||
--no-cache \
|
||||
--build-arg BUILD_TAG=$DOCKER_TAG \
|
||||
--build-arg GOPROXY \
|
||||
--build-arg GODEBUG \
|
||||
-f docker/${1/-//}/Dockerfile \
|
||||
-t photoprism/$1:$3 \
|
||||
--push .
|
||||
fi
|
||||
|
||||
echo "Removing multibuilder..."
|
||||
echo "docker/buildx-multi: removing multibuilder..."
|
||||
docker buildx rm multibuilder
|
||||
|
||||
echo "Done"
|
||||
echo "docker/buildx-multi: done"
|
|
@ -4,7 +4,7 @@
|
|||
export DOCKER_BUILDKIT=1
|
||||
|
||||
if [[ -z $1 ]] || [[ -z $2 ]]; then
|
||||
echo "Please provide the image name, and a list of target architectures e.g. linux/amd64,linux/arm64,linux/arm" 1>&2
|
||||
echo "docker/buildx: image name and target arch required (linux/amd64,linux/arm64,linux/arm)" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -12,7 +12,7 @@ NUMERIC='^[0-9]+$'
|
|||
GOPROXY=${GOPROXY:-'https://proxy.golang.org,direct'}
|
||||
|
||||
if [[ $1 ]] && [[ $2 ]] && [[ -z $3 ]]; then
|
||||
echo "Building 'photoprism/$1:preview'..."
|
||||
echo "docker/buildx: 'photoprism/$1:preview'..."
|
||||
DOCKER_TAG=$(date -u +%Y%m%d)
|
||||
docker buildx build \
|
||||
--platform $2 \
|
||||
|
@ -25,7 +25,7 @@ if [[ $1 ]] && [[ $2 ]] && [[ -z $3 ]]; then
|
|||
-t photoprism/$1:preview \
|
||||
--push .
|
||||
elif [[ $3 =~ $NUMERIC ]]; then
|
||||
echo "Building 'photoprism/$1:$3'..."
|
||||
echo "docker/buildx: 'photoprism/$1:$3'..."
|
||||
docker buildx build \
|
||||
--platform $2 \
|
||||
--pull \
|
||||
|
@ -38,7 +38,7 @@ elif [[ $3 =~ $NUMERIC ]]; then
|
|||
-t photoprism/$1:$3 \
|
||||
--push .
|
||||
elif [[ $4 ]]; then
|
||||
echo "Building 'photoprism/$1:$3' in docker/${1/-//}$4/Dockerfile..."
|
||||
echo "docker/buildx: 'photoprism/$1:$3' from docker/${1/-//}$4/Dockerfile..."
|
||||
DOCKER_TAG=$(date -u +%Y%m%d)
|
||||
docker buildx build \
|
||||
--platform $2 \
|
||||
|
@ -51,7 +51,7 @@ elif [[ $4 ]]; then
|
|||
-t photoprism/$1:$3 \
|
||||
--push .
|
||||
else
|
||||
echo "Building 'photoprism/$1:$3' in docker/${1/-//}/Dockerfile..."
|
||||
echo "docker/buildx: 'photoprism/$1:$3' from docker/${1/-//}/Dockerfile..."
|
||||
DOCKER_TAG=$(date -u +%Y%m%d)
|
||||
docker buildx build \
|
||||
--platform $2 \
|
||||
|
@ -65,4 +65,4 @@ else
|
|||
--push .
|
||||
fi
|
||||
|
||||
echo "Done"
|
||||
echo "docker/buildx: done"
|
Loading…
Reference in a new issue