ARG DEBIAN_FRONTEND=noninteractive
+# Buildx provided, must be defined to use though
+ARG TARGETARCH
+
+# Can be workflow provided, defaults set for manual building
+ARG JBIG2ENC_VERSION=0.29
+ARG QPDF_VERSION=11.6.1
+ARG GS_VERSION=10.02.0
+
#
# Begin installation and configuration
# Order the steps below from least often changed to most
echo "Installing system packages" \
&& apt-get update \
&& apt-get install --yes --quiet --no-install-recommends ${RUNTIME_PACKAGES} \
- && rm -rf /var/lib/apt/lists/* \
+ && echo "Installing pre-built updates" \
+ && echo "Installing qpdf ${QPDF_VERSION}" \
+ && curl --fail --silent --show-error --output libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb --location https://github.com/paperless-ngx/builder/releases/download/v0.0.0/libqpdf29_${QPDF_VERSION}-1_${TARGETARCH}.deb \
+ && curl --fail --silent --show-error --output qpdf_${QPDF_VERSION}-1_${TARGETARCH}.deb --location https://github.com/paperless-ngx/builder/releases/download/v0.0.0/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 --output libgs10_${GS_VERSION}.dfsg-2_${TARGETARCH}.deb --location https://github.com/paperless-ngx/builder/releases/download/v0.0.0/libgs10_${GS_VERSION}.dfsg-2_${TARGETARCH}.deb \
+ && curl --fail --silent --show-error --output ghostscript_${GS_VERSION}.dfsg-2_${TARGETARCH}.deb --location https://github.com/paperless-ngx/builder/releases/download/v0.0.0/ghostscript_${GS_VERSION}.dfsg-2_${TARGETARCH}.deb \
+ && curl --fail --silent --show-error --output libgs10-common_${GS_VERSION}.dfsg-2_all.deb --location https://github.com/paperless-ngx/builder/releases/download/v0.0.0/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 --output jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb --location https://github.com/paperless-ngx/builder/releases/download/v0.0.0/jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
+ && dpkg --install ./jbig2enc_${JBIG2ENC_VERSION}-1_${TARGETARCH}.deb \
+ && echo "Cleaning up image layer" \
+ && rm --force --verbose *.deb \
+ && rm --recursive --force --verbose /var/lib/apt/lists/* \
&& echo "Installing supervisor" \
&& python3 -m pip install --default-timeout=1000 --upgrade --no-cache-dir supervisor==4.2.5
&& chmod +x install_management_commands.sh \
&& ./install_management_commands.sh
-# Buildx provided, must be defined to use though
-ARG TARGETARCH
-ARG TARGETVARIANT
-
-# Can be workflow provided, defaults set for manual building
-ARG JBIG2ENC_VERSION=0.29
-
-# Install the built packages from the installer library images
-# These change sometimes
-RUN set -eux \
- && echo "Getting binaries" \
- && mkdir paperless-ngx \
- && curl --fail --silent --show-error --output paperless-ngx.tar.gz --location https://github.com/paperless-ngx/builder/archive/58bb061b9b3b63009852d6d875f9a305d9ae6ac9.tar.gz \
- && tar -xf paperless-ngx.tar.gz --directory paperless-ngx --strip-components=1 \
- && cd paperless-ngx \
- # Setting a specific revision ensures we know what this installed
- # and ensures cache breaking on changes
- && echo "Installing jbig2enc" \
- && cp ./jbig2enc/${JBIG2ENC_VERSION}/${TARGETARCH}${TARGETVARIANT}/jbig2 /usr/local/bin/ \
- && cp ./jbig2enc/${JBIG2ENC_VERSION}/${TARGETARCH}${TARGETVARIANT}/libjbig2enc* /usr/local/lib/ \
- && chmod a+x /usr/local/bin/jbig2 \
- && echo "Cleaning up image layer" \
- && cd ../ \
- && rm -rf paperless-ngx \
- && rm paperless-ngx.tar.gz
-
WORKDIR /usr/src/paperless/src/
# Python dependencies
&& apt-get -y purge ${BUILD_PACKAGES} \
&& apt-get -y autoremove --purge \
&& apt-get clean --yes \
- && rm -rf /var/lib/apt/lists/* \
- && rm -rf /tmp/* \
- && rm -rf /var/tmp/* \
- && rm -rf /var/cache/apt/archives/* \
- && truncate -s 0 /var/log/*log
+ && rm --recursive --force --verbose /var/lib/apt/lists/* \
+ && rm --recursive --force --verbose /tmp/* \
+ && rm --recursive --force --verbose /var/tmp/* \
+ && rm --recursive --force --verbose /var/cache/apt/archives/* \
+ && truncate --size 0 /var/log/*log
# copy backend
COPY ./src ./