A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Updates the utlity build script to actually support all the images
Trenton Holmesd9d6b7b151c0
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex fe9afb1a3..c2c25acb4 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -168,8 +168,8 @@ jobs:dockerfile: ./docker-builders/Dockerfile.psycopg2build-json: ${{ needs.prepare-docker-build.outputs.psycopg2-json }}build-args: |- GIT_TAG=${{ fromJSON(needs.prepare-docker-build.outputs.psycopg2-json).git_tag }}- VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.psycopg2-json).version }}+ PSYCOPG2_GIT_TAG=${{ fromJSON(needs.prepare-docker-build.outputs.psycopg2-json).git_tag }}+ PSYCOPG2_VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.psycopg2-json).version }}build-pikepdf-wheel:name: pikepdf@@ -183,8 +183,8 @@ jobs:build-args: |REPO=${{ github.repository }}QPDF_VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.qpdf-json).version }}- GIT_TAG=${{ fromJSON(needs.prepare-docker-build.outputs.pikepdf-json).git_tag }}- VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.pikepdf-json).version }}+ PIKEPDF_GIT_TAG=${{ fromJSON(needs.prepare-docker-build.outputs.pikepdf-json).git_tag }}+ PIKEPDF_VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.pikepdf-json).version }}build-frontend:name: Compile frontenddiff --git a/build-docker-image.sh b/build-docker-image.shindex 41c95167c..f7ab62ca6 100755--- a/build-docker-image.sh+++ b/build-docker-image.sh@@ -2,7 +2,8 @@# Helper script for building the Docker image locally.# Parses and provides the nessecary versions of other images to Docker-# before passing in the rest of script args+# before passing in the rest of script args. A future enhancement+# would be to combine this with the CI script# First Argument: The Dockerfile to build# Other Arguments: Additional arguments to docker build@@ -13,6 +14,14 @@set -eux+if ! command -v jq; then+ echo "jq required"+ exit 1+elif [ ! -f "$1" ]; then+ echo "$1 is not a file, please provide the Dockerfile"+ exit 1+fi+# Parse what we can from Pipfile.lockpikepdf_version=$(jq ".default.pikepdf.version" Pipfile.lock | sed 's/=//g' | sed 's/"//g')psycopg2_version=$(jq ".default.psycopg2.version" Pipfile.lock | sed 's/=//g' | sed 's/"//g')@@ -20,16 +29,19 @@ psycopg2_version=$(jq ".default.psycopg2.version" Pipfile.lock | sed 's/=//g' |qpdf_version=$(jq ".qpdf.version" .build-config.json | sed 's/"//g')jbig2enc_version=$(jq ".jbig2enc.version" .build-config.json | sed 's/"//g')# Get the branch name-frontend=$(git rev-parse --abbrev-ref HEAD)+frontend_version=$(git rev-parse --abbrev-ref HEAD)-if [ ! -f "$1" ]; then- echo "$1 is not a file, please provide the Dockerfile"- exit 1-fi+# Get Git tags for building+# psycopg2 uses X_Y_Z git tags+psycopg2_git_tag=${psycopg2_version//./_}+# pikepdf uses vX.Y.Z+pikepdf_git_tag="v${pikepdf_version}"docker build --file "$1" \--build-arg JBIG2ENC_VERSION="${jbig2enc_version}" \--build-arg QPDF_VERSION="${qpdf_version}" \--build-arg PIKEPDF_VERSION="${pikepdf_version}" \+ --build-arg PIKEPDF_GIT_TAG="${pikepdf_git_tag}" \--build-arg PSYCOPG2_VERSION="${psycopg2_version}" \- --build-arg FRONTEND_VERSION="${frontend}" "${@:2}" .+ --build-arg PSYCOPG2_GIT_TAG="${psycopg2_git_tag}" \+ --build-arg FRONTEND_VERSION="${frontend_version}" "${@:2}" .diff --git a/docker-builders/Dockerfile.pikepdf b/docker-builders/Dockerfile.pikepdfindex be544e282..7325bceff 100644--- a/docker-builders/Dockerfile.pikepdf+++ b/docker-builders/Dockerfile.pikepdf@@ -2,8 +2,8 @@# Inputs:# - REPO - Docker repository to pull qpdf from# - QPDF_VERSION - The image qpdf version to copy .deb files from-# - GIT_TAG - The Git tag to clone and build from-# - VERSION - Used to force the built pikepdf version to match+# - PIKEPDF_GIT_TAG - The Git tag to clone and build from+# - PIKEPDF_VERSION - Used to force the built pikepdf version to match# Default to pulling from the main repo registry when manually buildingARG REPO="paperless-ngx/paperless-ngx"@@ -32,7 +32,7 @@ ARG BUILD_PACKAGES="\WORKDIR /usr/src-COPY --from=qpdf-builder /usr/src/qpdf/*.deb .+COPY --from=qpdf-builder /usr/src/qpdf/*.deb ./# As this is an base image for a multi-stage final image# the added size of the install is basically irrelevant@@ -49,19 +49,19 @@ RUN set -eux \# For better caching, seperate the basic installs from# the building-ARG GIT_TAG-ARG VERSION+ARG PIKEPDF_GIT_TAG+ARG PIKEPDF_VERSIONRUN set -eux \&& echo "building pikepdf wheel" \# Note the v in the tag name here- && git clone --quiet --depth 1 --branch "${GIT_TAG}" https://github.com/pikepdf/pikepdf.git \+ && git clone --quiet --depth 1 --branch "${PIKEPDF_GIT_TAG}" https://github.com/pikepdf/pikepdf.git \&& cd pikepdf \# pikepdf seems to specifciy either a next version when built OR# a post release tag.# In either case, this won't match what we want from requirements.txt# Directly modify the setup.py to set the version we just checked out of Git- && sed -i "s/use_scm_version=True/version=\"${VERSION}\"/g" setup.py \+ && sed -i "s/use_scm_version=True/version=\"${PIKEPDF_VERSION}\"/g" setup.py \# https://github.com/pikepdf/pikepdf/issues/323&& rm pyproject.toml \&& mkdir wheels \diff --git a/docker-builders/Dockerfile.psycopg2 b/docker-builders/Dockerfile.psycopg2index 0c1cc048b..cbfbba7c1 100644--- a/docker-builders/Dockerfile.psycopg2+++ b/docker-builders/Dockerfile.psycopg2@@ -1,7 +1,7 @@# This Dockerfile builds the psycopg2 wheel# Inputs:-# - GIT_TAG - The Git tag to clone and build from-# - VERSION - Unused, kept for future possible usage+# - PSYCOPG2_GIT_TAG - The Git tag to clone and build from+# - PSYCOPG2_VERSION - Unused, kept for future possible usageFROM python:3.9-slim-bullseye@@ -31,13 +31,13 @@ RUN set -eux \# For better caching, seperate the basic installs from# the building-ARG GIT_TAG-ARG VERSION+ARG PSYCOPG2_GIT_TAG+ARG PSYCOPG2_VERSIONRUN set -eux \&& echo "Building psycopg2 wheel" \&& cd /usr/src \- && git clone --quiet --depth 1 --branch ${GIT_TAG} https://github.com/psycopg/psycopg2.git \+ && git clone --quiet --depth 1 --branch ${PSYCOPG2_GIT_TAG} https://github.com/psycopg/psycopg2.git \&& cd psycopg2 \&& mkdir wheels \&& python3 -m pip wheel . --wheel-dir wheels \