CI: Add Dockerfiles and update Makefile for Ubuntu 22.04 "Jammy" build

This commit is contained in:
Michael Mayer 2022-04-05 15:31:29 +02:00
parent 772da6baba
commit 30fe713594
3 changed files with 308 additions and 2 deletions

View file

@ -274,6 +274,10 @@ docker-develop-impish:
docker pull --platform=amd64 ubuntu:impish
docker pull --platform=arm64 ubuntu:impish
scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 impish /impish
docker-develop-jammy:
docker pull --platform=amd64 ubuntu:jammy
docker pull --platform=arm64 ubuntu:jammy
scripts/docker/buildx-multi.sh develop linux/amd64,linux/arm64 jammy /jammy
docker-preview: docker-preview-bookworm
docker-preview-all: docker-preview docker-preview-bullseye docker-preview-buster docker-preview-impish
docker-preview-arm: docker-preview-arm64 docker-preview-armv7
@ -303,9 +307,15 @@ docker-preview-buster:
docker pull --platform=amd64 debian:buster-slim
docker pull --platform=arm64 debian:buster-slim
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview-buster /buster
docker-preview-jammy:
docker pull --platform=amd64 photoprism/develop:jammy
docker pull --platform=arm64 photoprism/develop:jammy
docker pull --platform=amd64 ubuntu:jammy
docker pull --platform=arm64 ubuntu:jammy
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview-jammy /jammy
docker-preview-impish:
docker pull --platform=amd64 photoprism/develop:latest
docker pull --platform=arm64 photoprism/develop:latest
docker pull --platform=amd64 photoprism/develop:impish
docker pull --platform=arm64 photoprism/develop:impish
docker pull --platform=amd64 ubuntu:impish
docker pull --platform=arm64 ubuntu:impish
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 preview-impish /impish
@ -338,6 +348,12 @@ docker-release-buster:
docker pull --platform=amd64 debian:buster-slim
docker pull --platform=arm64 debian:buster-slim
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 buster /buster
docker-preview-jammy:
docker pull --platform=amd64 photoprism/develop:jammy
docker pull --platform=arm64 photoprism/develop:jammy
docker pull --platform=amd64 ubuntu:jammy
docker pull --platform=arm64 ubuntu:jammy
scripts/docker/buildx-multi.sh photoprism linux/amd64,linux/arm64 jammy /jammy
docker-release-impish:
docker pull --platform=amd64 photoprism/develop:impish
docker pull --platform=arm64 photoprism/develop:impish

View file

@ -0,0 +1,147 @@
#### Base Image: Ubuntu 22.04, Codename "Jammy Jellyfish"
FROM ubuntu:jammy
LABEL maintainer="Michael Mayer <hello@photoprism.app>"
ARG TARGETARCH
ARG BUILD_TAG
# set environment variables
ENV PHOTOPRISM_ARCH=$TARGETARCH \
DOCKER_TAG=$BUILD_TAG \
DOCKER_ENV="develop" \
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"
# copy scripts and debian backports sources list
COPY --chown=root:root --chmod=755 /scripts/dist/* /scripts/
COPY --chown=root:root --chmod=644 /.my.cnf /etc/my.cnf
# update image and install build dependencies
RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
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 && \
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 && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
apt-utils \
gpg \
gpg-agent \
pkg-config \
software-properties-common \
ca-certificates \
build-essential \
g++ \
gcc \
sudo \
bash \
make \
nano \
lsof \
lshw \
wget \
curl \
jq \
git \
zip \
unzip \
gettext \
firefox \
mariadb-client \
davfs2 \
chrpath \
libc6-dev \
libssl-dev \
libxft-dev \
libfreetype6 \
libfreetype6-dev \
libfontconfig1 \
libfontconfig1-dev \
libhdf5-serial-dev \
libpng-dev \
libzmq3-dev \
libx264-dev \
libx265-dev \
libnss3 \
libxtst6 \
librsvg2-bin \
rsync \
sqlite3 \
tzdata \
libheif-examples \
exiftool \
rawtherapee \
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra \
apache2-utils \
fonts-roboto \
npm \
&& \
/scripts/install-tensorflow.sh && \
/scripts/install-darktable.sh && \
/scripts/install-chrome.sh && \
/scripts/install-go.sh && \
/scripts/cleanup.sh && \
mkdir -p "/go/src" "/go/bin" && \
chmod -R 777 "/go" && \
install -d -m 0777 -o 1000 -g 1000 \
/var/lib/photoprism \
/tmp/photoprism \
/photoprism/originals \
/photoprism/import \
/photoprism/storage \
/photoprism/storage/sidecar \
/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 && \
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"
# expose the following container ports:
# - 2342 (HTTP)
# - 2343 (Acceptance Tests)
# - 9515 (Chromedriver)
# - 40000 (Go Debugger)
EXPOSE 2342 2343 9515 40000
# set container entrypoint script
ENTRYPOINT ["/scripts/entrypoint.sh"]
# keep container running
CMD ["tail", "-f", "/dev/null"]

View file

@ -0,0 +1,143 @@
##################################################### BUILD STAGE ######################################################
FROM photoprism/develop:jammy as build
ARG TARGETARCH
ARG BUILD_TAG
# set up project directory
WORKDIR "/go/src/github.com/photoprism/photoprism"
COPY . .
# build and install dist files for prod env
RUN make all install DESTDIR=/opt/photoprism
################################################## PRODUCTION STAGE ####################################################
#### Base Image: Ubuntu 22.04, Codename "Jammy Jellyfish"
FROM ubuntu:jammy
LABEL maintainer="Michael Mayer <hello@photoprism.app>"
ARG TARGETARCH
ARG BUILD_TAG
# set environment variables, see https://docs.photoprism.app/getting-started/config-options/
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" \
PHOTOPRISM_ASSETS_PATH="/opt/photoprism/assets" \
PHOTOPRISM_IMPORT_PATH="/photoprism/import" \
PHOTOPRISM_ORIGINALS_PATH="/photoprism/originals" \
PHOTOPRISM_STORAGE_PATH="/photoprism/storage" \
PHOTOPRISM_BACKUP_PATH="/photoprism/storage/backups" \
PHOTOPRISM_LOG_FILENAME="/photoprism/storage/photoprism.log" \
PHOTOPRISM_PID_FILENAME="/photoprism/storage/photoprism.pid" \
PHOTOPRISM_DEBUG="false" \
PHOTOPRISM_PUBLIC="false" \
PHOTOPRISM_READONLY="false" \
PHOTOPRISM_UPLOAD_NSFW="true" \
PHOTOPRISM_DETECT_NSFW="false" \
PHOTOPRISM_EXPERIMENTAL="false" \
PHOTOPRISM_SITE_URL="http://localhost:2342/" \
PHOTOPRISM_SITE_TITLE="PhotoPrism" \
PHOTOPRISM_SITE_CAPTION="AI-Powered Photos App" \
PHOTOPRISM_SITE_DESCRIPTION="" \
PHOTOPRISM_SITE_AUTHOR="" \
PHOTOPRISM_HTTP_HOST="0.0.0.0" \
PHOTOPRISM_HTTP_PORT=2342 \
PHOTOPRISM_DATABASE_DRIVER="sqlite" \
PHOTOPRISM_DATABASE_SERVER="" \
PHOTOPRISM_DATABASE_NAME="photoprism" \
PHOTOPRISM_DATABASE_USER="photoprism" \
PHOTOPRISM_DATABASE_PASSWORD="" \
PHOTOPRISM_DISABLE_CHOWN="false" \
PHOTOPRISM_DISABLE_WEBDAV="false" \
PHOTOPRISM_DISABLE_SETTINGS="false" \
PHOTOPRISM_DISABLE_BACKUPS="false" \
PHOTOPRISM_DISABLE_EXIFTOOL="false" \
PHOTOPRISM_DISABLE_PLACES="false" \
PHOTOPRISM_DISABLE_TENSORFLOW="false" \
PHOTOPRISM_DISABLE_FACES="false" \
PHOTOPRISM_DISABLE_CLASSIFICATION="false" \
PHOTOPRISM_RAW_PRESETS="false" \
PHOTOPRISM_THUMB_FILTER="lanczos" \
PHOTOPRISM_THUMB_UNCACHED="false" \
PHOTOPRISM_THUMB_SIZE=2048 \
PHOTOPRISM_THUMB_SIZE_UNCACHED=7680 \
PHOTOPRISM_JPEG_SIZE=7680 \
PHOTOPRISM_JPEG_QUALITY=85 \
PHOTOPRISM_WORKERS=0 \
PHOTOPRISM_WAKEUP_INTERVAL=900 \
PHOTOPRISM_AUTO_INDEX=300 \
PHOTOPRISM_AUTO_IMPORT=300
# copy dist files and scripts
COPY --from=build /opt/photoprism/ /opt/photoprism
COPY --chown=root:root --chmod=755 /scripts/dist/* /scripts/
# install additional distribution packages
RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
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 && \
mv /opt/photoprism/sbin/gosu /sbin/gosu && \
chown root:root /sbin/gosu && \
chmod 755 /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 && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
ca-certificates \
jq \
lshw \
gpg \
wget \
curl \
make \
sudo \
bash \
mariadb-client \
sqlite3 \
tzdata \
libc6 \
libatomic1 \
libheif-examples \
librsvg2-bin \
exiftool \
rawtherapee \
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra \
&& \
/scripts/install-darktable.sh && \
install -d -m 0777 -o 1000 -g 1000 \
/var/lib/photoprism \
/tmp/photoprism \
/photoprism/originals \
/photoprism/import \
/photoprism/storage \
/photoprism/storage/sidecar \
/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
# define default directory and user
WORKDIR /photoprism
# expose default http port 2342
EXPOSE 2342
# set container entrypoint script
ENTRYPOINT ["/scripts/entrypoint.sh"]
# start app server
CMD ["/opt/photoprism/bin/photoprism", "start"]