From a2bdd64ad0fcb36d3e6ca95e391e6bed90c26f75 Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Thu, 5 Oct 2023 10:51:58 -0700 Subject: [PATCH] Feature: Include more updated base tools in Docker image (#4319) * New method for installing jbig2enc * Installs newer qpdf, ghostscript as well as jbig2enc --- Dockerfile | 64 +++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/Dockerfile b/Dockerfile index d4eca064f..84c65cfd4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,6 +47,14 @@ LABEL org.opencontainers.image.licenses="GPL-3.0-only" 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 @@ -102,7 +110,25 @@ RUN set -eux \ 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 @@ -153,32 +179,6 @@ RUN set -eux \ && 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 @@ -213,11 +213,11 @@ RUN --mount=type=cache,target=/root/.cache/pip/,id=pip-cache \ && 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 ./