|
|
|
|
@@ -12,13 +12,13 @@ COPY ./src-ui /src/src-ui
|
|
|
|
|
WORKDIR /src/src-ui
|
|
|
|
|
RUN set -eux \
|
|
|
|
|
&& npm update npm -g \
|
|
|
|
|
&& npm ci --omit=optional
|
|
|
|
|
&& npm ci
|
|
|
|
|
RUN set -eux \
|
|
|
|
|
&& ./node_modules/.bin/ng build --configuration production
|
|
|
|
|
|
|
|
|
|
# Stage: main-app
|
|
|
|
|
# Purpose: The final image
|
|
|
|
|
FROM docker.io/python:3.11-bookworm as main-app
|
|
|
|
|
FROM --platform=$BUILDPLATFORM docker.io/node:20-bookworm-slim as main-app
|
|
|
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
|
|
@@ -27,8 +27,15 @@ ARG TARGETARCH
|
|
|
|
|
|
|
|
|
|
# Can be workflow provided, defaults set for manual building
|
|
|
|
|
ARG JBIG2ENC_VERSION=0.29
|
|
|
|
|
ARG QPDF_VERSION=11.6.3
|
|
|
|
|
ARG GS_VERSION=10.02.0
|
|
|
|
|
ARG QPDF_VERSION=11.9.0
|
|
|
|
|
ARG GS_VERSION=10.03.1
|
|
|
|
|
|
|
|
|
|
# Set Python environment variables
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
|
# Ignore warning from Whitenoise
|
|
|
|
|
PYTHONWARNINGS="ignore:::django.http.response:517" \
|
|
|
|
|
PNGX_CONTAINERIZED=1
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Begin installation and configuration
|
|
|
|
|
@@ -51,7 +58,6 @@ ARG RUNTIME_PACKAGES="\
|
|
|
|
|
icc-profiles-free \
|
|
|
|
|
imagemagick \
|
|
|
|
|
# PostgreSQL
|
|
|
|
|
libpq5 \
|
|
|
|
|
postgresql-client \
|
|
|
|
|
# MySQL / MariaDB
|
|
|
|
|
mariadb-client \
|
|
|
|
|
@@ -77,47 +83,58 @@ ARG RUNTIME_PACKAGES="\
|
|
|
|
|
zlib1g \
|
|
|
|
|
# Barcode splitter
|
|
|
|
|
libzbar0 \
|
|
|
|
|
poppler-utils"
|
|
|
|
|
|
|
|
|
|
# Install Pipenv
|
|
|
|
|
RUN set -eux \
|
|
|
|
|
&& echo "Installing pipenv" \
|
|
|
|
|
&& python3 -m pip install --no-cache-dir --upgrade pipenv==2023.10.24
|
|
|
|
|
poppler-utils \
|
|
|
|
|
htop \
|
|
|
|
|
sudo"
|
|
|
|
|
|
|
|
|
|
# Install basic runtime packages.
|
|
|
|
|
# These change very infrequently
|
|
|
|
|
RUN set -eux \
|
|
|
|
|
echo "Installing system packages" \
|
|
|
|
|
&& apt-get update \
|
|
|
|
|
&& apt-get install --yes --quiet --no-install-recommends ${RUNTIME_PACKAGES} \
|
|
|
|
|
&& echo "Installing pre-built updates" \
|
|
|
|
|
&& echo "Installing qpdf ${QPDF_VERSION}" \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/qpdf-${QPDF_VERSION}/libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/qpdf-${QPDF_VERSION}/qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
&& dpkg --install ./libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
&& dpkg --install ./qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
&& echo "Installing Ghostscript ${GS_VERSION}" \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output libgs10_${GS_VERSION}.dfsg-2_${TARGETARCH}.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/libgs10_${GS_VERSION}.dfsg-2_${TARGETARCH}.deb \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output ghostscript_${GS_VERSION}.dfsg-2_${TARGETARCH}.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/ghostscript_${GS_VERSION}.dfsg-2_${TARGETARCH}.deb \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output libgs10-common_${GS_VERSION}.dfsg-2_all.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/libgs10-common_${GS_VERSION}.dfsg-2_all.deb \
|
|
|
|
|
&& dpkg --install ./libgs10-common_${GS_VERSION}.dfsg-2_all.deb \
|
|
|
|
|
&& dpkg --install ./libgs10_${GS_VERSION}.dfsg-2_${TARGETARCH}.deb \
|
|
|
|
|
&& dpkg --install ./ghostscript_${GS_VERSION}.dfsg-2_${TARGETARCH}.deb \
|
|
|
|
|
&& echo "Installing jbig2enc" \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/jbig2enc-${JBIG2ENC_VERSION}/jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
&& dpkg --install ./jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb
|
|
|
|
|
&& apt-get install --yes --quiet --no-install-recommends ${RUNTIME_PACKAGES}
|
|
|
|
|
|
|
|
|
|
ARG PYTHON_PACKAGES="\
|
|
|
|
|
python3 \
|
|
|
|
|
python3-pip \
|
|
|
|
|
python3-wheel \
|
|
|
|
|
pipenv \
|
|
|
|
|
ca-certificates"
|
|
|
|
|
|
|
|
|
|
RUN set -eux \
|
|
|
|
|
echo "Installing python packages" \
|
|
|
|
|
&& apt-get update \
|
|
|
|
|
&& apt-get install --yes --quiet ${PYTHON_PACKAGES}
|
|
|
|
|
|
|
|
|
|
RUN set -eux \
|
|
|
|
|
&& echo "Installing pre-built updates" \
|
|
|
|
|
&& echo "Installing qpdf ${QPDF_VERSION}" \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/qpdf-${QPDF_VERSION}/libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/qpdf-${QPDF_VERSION}/qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
&& dpkg --install ./libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
&& dpkg --install ./qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
&& echo "Installing Ghostscript ${GS_VERSION}" \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output libgs10_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/libgs10_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output ghostscript_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/ghostscript_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output libgs10-common_${GS_VERSION}.dfsg-1_all.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/ghostscript-${GS_VERSION}/libgs10-common_${GS_VERSION}.dfsg-1_all.deb \
|
|
|
|
|
&& dpkg --install ./libgs10-common_${GS_VERSION}.dfsg-1_all.deb \
|
|
|
|
|
&& dpkg --install ./libgs10_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
|
|
|
&& dpkg --install ./ghostscript_${GS_VERSION}.dfsg-1_${TARGETARCH}.deb \
|
|
|
|
|
&& echo "Installing jbig2enc" \
|
|
|
|
|
&& curl --fail --silent --show-error --location \
|
|
|
|
|
--output jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
https://github.com/paperless-ngx/builder/releases/download/jbig2enc-${JBIG2ENC_VERSION}/jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
|
|
|
|
|
&& dpkg --install ./jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb
|
|
|
|
|
|
|
|
|
|
# setup docker-specific things
|
|
|
|
|
# These change sometimes, but rarely
|
|
|
|
|
@@ -128,7 +145,7 @@ COPY [ \
|
|
|
|
|
"docker/wait-for-redis.py", \
|
|
|
|
|
"docker/env-from-file.sh", \
|
|
|
|
|
"docker/flower-conditional.sh", \
|
|
|
|
|
"/usr/src/paperless/src/docker/" \
|
|
|
|
|
"./" \
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
RUN set -eux \
|
|
|
|
|
@@ -151,18 +168,17 @@ ARG BUILD_PACKAGES="\
|
|
|
|
|
libpq-dev \
|
|
|
|
|
# https://github.com/PyMySQL/mysqlclient#linux
|
|
|
|
|
default-libmysqlclient-dev \
|
|
|
|
|
pkg-config"
|
|
|
|
|
pkg-config \
|
|
|
|
|
pre-commit"
|
|
|
|
|
|
|
|
|
|
# hadolint ignore=DL3042
|
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/pip/,id=pip-cache \
|
|
|
|
|
set -eux \
|
|
|
|
|
&& echo "Installing build system packages" \
|
|
|
|
|
&& apt-get update \
|
|
|
|
|
&& apt-get install --yes --quiet --no-install-recommends ${BUILD_PACKAGES} \
|
|
|
|
|
&& python3 -m pip install --no-cache-dir --upgrade wheel
|
|
|
|
|
&& apt-get install --yes --quiet ${BUILD_PACKAGES}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /usr/src/paperless/paperless/
|
|
|
|
|
WORKDIR /usr/src/paperless/paperless-ngx/
|
|
|
|
|
|
|
|
|
|
# copy frontend
|
|
|
|
|
COPY --from=compile-frontend --chown=1000:1000 /src/src/documents/static ./static
|
|
|
|
|
@@ -171,22 +187,23 @@ COPY --from=compile-frontend --chown=1000:1000 /src/src/documents/static ./stati
|
|
|
|
|
# Mount the compiled frontend to expected location
|
|
|
|
|
RUN set -eux \
|
|
|
|
|
&& echo "Setting up user/group" \
|
|
|
|
|
&& addgroup --gid 1000 paperless \
|
|
|
|
|
&& useradd --uid 1000 --gid paperless --home-dir /usr/src/paperless paperless \
|
|
|
|
|
&& groupmod --new-name paperless node \
|
|
|
|
|
&& usermod --login paperless --home /usr/src/paperless node \
|
|
|
|
|
&& usermod -s /bin/bash paperless \
|
|
|
|
|
&& echo "Creating volume directories" \
|
|
|
|
|
&& mkdir --parents --verbose /usr/src/paperless/data \
|
|
|
|
|
&& mkdir --parents --verbose /usr/src/paperless/media \
|
|
|
|
|
&& mkdir --parents --verbose /usr/src/paperless/consume \
|
|
|
|
|
&& mkdir --parents --verbose /usr/src/paperless/export \
|
|
|
|
|
&& mkdir --parents --verbose /usr/src/paperless/paperless/.venv \
|
|
|
|
|
&& mkdir --parents --verbose /usr/src/paperless/paperless-ngx/data \
|
|
|
|
|
&& mkdir --parents --verbose /usr/src/paperless/paperless-ngx/media \
|
|
|
|
|
&& mkdir --parents --verbose /usr/src/paperless/paperless-ngx/consume \
|
|
|
|
|
&& mkdir --parents --verbose /usr/src/paperless/paperless-ngx/export \
|
|
|
|
|
&& mkdir --parents --verbose /usr/src/paperless/paperless-ngx/.venv \
|
|
|
|
|
&& echo "Adjusting all permissions" \
|
|
|
|
|
&& chown --from root:root --changes --recursive paperless:paperless /usr/src/paperless
|
|
|
|
|
# && echo "Collecting static files" \
|
|
|
|
|
# && gosu paperless python3 manage.py collectstatic --clear --no-input --link \
|
|
|
|
|
# && gosu paperless python3 manage.py compilemessages
|
|
|
|
|
|
|
|
|
|
VOLUME ["/usr/src/paperless/data", \
|
|
|
|
|
"/usr/src/paperless/media", \
|
|
|
|
|
"/usr/src/paperless/consume", \
|
|
|
|
|
"/usr/src/paperless/export"]
|
|
|
|
|
VOLUME ["/usr/src/paperless/paperless-ngx/data", \
|
|
|
|
|
"/usr/src/paperless/paperless-ngx/media", \
|
|
|
|
|
"/usr/src/paperless/paperless-ngx/consume", \
|
|
|
|
|
"/usr/src/paperless/paperless-ngx/export", \
|
|
|
|
|
"/usr/src/paperless/paperless-ngx/.venv"]
|
|
|
|
|
|