A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Decrease the final size of the images containing .deb and .whl files
Trenton Holmes45fd01a6889a
diff --git a/docker-builders/Dockerfile.jbig2enc b/docker-builders/Dockerfile.jbig2encindex d9f1643fd..90318084f 100644--- a/docker-builders/Dockerfile.jbig2enc+++ b/docker-builders/Dockerfile.jbig2enc@@ -7,6 +7,7 @@ FROM debian:bullseye-slim as mainLABEL org.opencontainers.image.description="A intermediate image with jbig2enc built"ARG DEBIAN_FRONTEND=noninteractive+ARG JBIG2ENC_VERSIONARG BUILD_PACKAGES="\build-essential \@@ -19,21 +20,16 @@ ARG BUILD_PACKAGES="\WORKDIR /usr/src/jbig2enc-# As this is an base image for a multi-stage final image-# the added size of the install is basically irrelevant-RUN apt-get update --quiet \- && apt-get install --yes --quiet --no-install-recommends ${BUILD_PACKAGES} \- && rm -rf /var/lib/apt/lists/*--# Layers after this point change according to required version-# For better caching, seperate the basic installs from-# the building--ARG JBIG2ENC_VERSION--RUN set -eux \- && git clone --quiet --branch $JBIG2ENC_VERSION https://github.com/agl/jbig2enc .-RUN set -eux \- && ./autogen.shRUN set -eux \- && ./configure && make+ && echo "Installing build tools" \+ && apt-get update --quiet \+ && apt-get install --yes --quiet --no-install-recommends ${BUILD_PACKAGES} \+ && echo "Building jbig2enc" \+ && git clone --quiet --branch $JBIG2ENC_VERSION https://github.com/agl/jbig2enc . \+ && ./autogen.sh \+ && ./configure \+ && make \+ && echo "Cleaning up image" \+ && apt-get -y purge ${BUILD_PACKAGES} \+ && apt-get -y autoremove --purge \+ && rm -rf /var/lib/apt/lists/*diff --git a/docker-builders/Dockerfile.pikepdf b/docker-builders/Dockerfile.pikepdfindex ff7086b7c..5f0c3eea2 100644--- a/docker-builders/Dockerfile.pikepdf+++ b/docker-builders/Dockerfile.pikepdf@@ -17,6 +17,7 @@ FROM python:3.9-slim-bullseye as mainLABEL org.opencontainers.image.description="A intermediate image with pikepdf wheel built"ARG DEBIAN_FRONTEND=noninteractive+ARG PIKEPDF_VERSIONARG BUILD_PACKAGES="\build-essential \@@ -55,34 +56,33 @@ COPY --from=qpdf-builder /usr/src/qpdf/*.deb ./# the added size of the install is basically irrelevantRUN set -eux \- && apt-get update --quiet \- && apt-get install --yes --quiet --no-install-recommends $BUILD_PACKAGES \- && dpkg --install libqpdf28_*.deb \- && dpkg --install libqpdf-dev_*.deb \- && python3 -m pip install --no-cache-dir --upgrade \- pip \- wheel \- # https://pikepdf.readthedocs.io/en/latest/installation.html#requirements- pybind11 \- && rm -rf /var/lib/apt/lists/*--# Layers after this point change according to required version-# For better caching, seperate the basic installs from-# the building--ARG PIKEPDF_VERSION--RUN set -eux \+ && echo "Installing build tools" \+ && apt-get update --quiet \+ && apt-get install --yes --quiet --no-install-recommends ${BUILD_PACKAGES} \+ && echo "Installing qpdf" \+ && dpkg --install libqpdf28_*.deb \+ && dpkg --install libqpdf-dev_*.deb \+ && echo "Installing Python tools" \+ && python3 -m pip install --no-cache-dir --upgrade \+ pip \+ wheel \+ # https://pikepdf.readthedocs.io/en/latest/installation.html#requirements+ pybind11 \&& echo "Building pikepdf wheel ${PIKEPDF_VERSION}" \- && mkdir wheels \- && python3 -m pip wheel \- # Build the package at the required version- pikepdf==${PIKEPDF_VERSION} \- # Output the *.whl into this directory- --wheel-dir wheels \- # Do not use a binary packge for the package being built- --no-binary=pikepdf \- # Do use binary packages for dependencies- --prefer-binary \- --no-cache-dir \- && ls -ahl wheels+ && mkdir wheels \+ && python3 -m pip wheel \+ # Build the package at the required version+ pikepdf==${PIKEPDF_VERSION} \+ # Output the *.whl into this directory+ --wheel-dir wheels \+ # Do not use a binary packge for the package being built+ --no-binary=pikepdf \+ # Do use binary packages for dependencies+ --prefer-binary \+ # Don't cache build files+ --no-cache-dir \+ && ls -ahl wheels \+ && echo "Cleaning up image" \+ && apt-get -y purge ${BUILD_PACKAGES} \+ && apt-get -y autoremove --purge \+ && rm -rf /var/lib/apt/lists/*diff --git a/docker-builders/Dockerfile.psycopg2 b/docker-builders/Dockerfile.psycopg2index 5e6157a02..56bc7a1b2 100644--- a/docker-builders/Dockerfile.psycopg2+++ b/docker-builders/Dockerfile.psycopg2@@ -6,6 +6,7 @@ FROM python:3.9-slim-bullseye as mainLABEL org.opencontainers.image.description="A intermediate image with psycopg2 wheel built"+ARG PSYCOPG2_VERSIONARG DEBIAN_FRONTEND=noninteractiveARG BUILD_PACKAGES="\@@ -21,29 +22,27 @@ WORKDIR /usr/src# the added size of the install is basically irrelevantRUN set -eux \- && apt-get update --quiet \- && apt-get install --yes --quiet --no-install-recommends $BUILD_PACKAGES \- && rm -rf /var/lib/apt/lists/* \- && python3 -m pip install --no-cache-dir --upgrade pip wheel--# Layers after this point change according to required version-# For better caching, seperate the basic installs from-# the building--ARG PSYCOPG2_VERSION--RUN set -eux \+ && echo "Installing build tools" \+ && apt-get update --quiet \+ && apt-get install --yes --quiet --no-install-recommends ${BUILD_PACKAGES} \+ && echo "Installing Python tools" \+ && python3 -m pip install --no-cache-dir --upgrade pip wheel \&& echo "Building psycopg2 wheel ${PSYCOPG2_VERSION}" \- && cd /usr/src \- && mkdir wheels \- && python3 -m pip wheel \- # Build the package at the required version- psycopg2==${PSYCOPG2_VERSION} \- # Output the *.whl into this directory- --wheel-dir wheels \- # Do not use a binary packge for the package being built- --no-binary=psycopg2 \- # Do use binary packages for dependencies- --prefer-binary \- --no-cache-dir \- && ls -ahl wheels/+ && cd /usr/src \+ && mkdir wheels \+ && python3 -m pip wheel \+ # Build the package at the required version+ psycopg2==${PSYCOPG2_VERSION} \+ # Output the *.whl into this directory+ --wheel-dir wheels \+ # Do not use a binary packge for the package being built+ --no-binary=psycopg2 \+ # Do use binary packages for dependencies+ --prefer-binary \+ # Don't cache build files+ --no-cache-dir \+ && ls -ahl wheels/ \+ && echo "Cleaning up image" \+ && apt-get -y purge ${BUILD_PACKAGES} \+ && apt-get -y autoremove --purge \+ && rm -rf /var/lib/apt/lists/*diff --git a/docker-builders/Dockerfile.qpdf b/docker-builders/Dockerfile.qpdfindex 0d738a4ad..0cc5fba24 100644--- a/docker-builders/Dockerfile.qpdf+++ b/docker-builders/Dockerfile.qpdf@@ -1,8 +1,15 @@+# This Dockerfile compiles the jbig2enc library+# Inputs:+# - QPDF_VERSION - the version of qpdf to build a .deb.+# Must be preset as a deb-src+FROM debian:bullseye-slim as mainLABEL org.opencontainers.image.description="A intermediate image with qpdf built"ARG DEBIAN_FRONTEND=noninteractive+# This must match to pikepdf's minimum at least+ARG QPDF_VERSIONARG BUILD_PACKAGES="\build-essential \@@ -23,31 +30,23 @@ WORKDIR /usr/src# the added size of the install is basically irrelevantRUN set -eux \- && apt-get update --quiet \- && apt-get install --yes --quiet --no-install-recommends $BUILD_PACKAGES \- && rm -rf /var/lib/apt/lists/*--# Layers after this point change according to required version-# For better caching, seperate the basic installs from-# the building--# This must match to pikepdf's minimum at least-ARG QPDF_VERSION--# In order to get the required version of qpdf, it is backported from bookwork-# and then built from source-RUN set -eux \+ && echo "Installing build tools" \+ && apt-get update --quiet \+ && apt-get install --yes --quiet --no-install-recommends $BUILD_PACKAGES \&& echo "Building qpdf" \- && echo "deb-src http://deb.debian.org/debian/ bookworm main" > /etc/apt/sources.list.d/bookworm-src.list \- && apt-get update \- && mkdir qpdf \- && cd qpdf \- && apt-get source --yes --quiet qpdf=${QPDF_VERSION}-1/bookworm \- && rm -rf /var/lib/apt/lists/* \- && cd qpdf-$QPDF_VERSION \- # We don't need to build the tests (also don't run them)- && rm -rf libtests \- && [email protected] debchange --bpo \- && export DEB_BUILD_OPTIONS="terse nocheck nodoc parallel=2" \- && dpkg-buildpackage --build=binary --unsigned-source --unsigned-changes \- && ls -ahl ../*.deb+ && echo "deb-src http://deb.debian.org/debian/ bookworm main" > /etc/apt/sources.list.d/bookworm-src.list \+ && apt-get update \+ && mkdir qpdf \+ && cd qpdf \+ && apt-get source --yes --quiet qpdf=${QPDF_VERSION}-1/bookworm \+ && cd qpdf-$QPDF_VERSION \+ # We don't need to build the tests (also don't run them)+ && rm -rf libtests \+ && [email protected] debchange --bpo \+ && export DEB_BUILD_OPTIONS="terse nocheck nodoc parallel=2" \+ && dpkg-buildpackage --build=binary --unsigned-source --unsigned-changes --post-clean \+ && ls -ahl ../*.deb \+ && echo "Cleaning up image" \+ && apt-get -y purge ${BUILD_PACKAGES} \+ && apt-get -y autoremove --purge \+ && rm -rf /var/lib/apt/lists/*