mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-09 09:58:20 -05:00
Updates the utlity build script to actually support all the images
This commit is contained in:
parent
4517692c20
commit
d9d6b7b151
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -168,8 +168,8 @@ jobs:
|
|||||||
dockerfile: ./docker-builders/Dockerfile.psycopg2
|
dockerfile: ./docker-builders/Dockerfile.psycopg2
|
||||||
build-json: ${{ needs.prepare-docker-build.outputs.psycopg2-json }}
|
build-json: ${{ needs.prepare-docker-build.outputs.psycopg2-json }}
|
||||||
build-args: |
|
build-args: |
|
||||||
GIT_TAG=${{ fromJSON(needs.prepare-docker-build.outputs.psycopg2-json).git_tag }}
|
PSYCOPG2_GIT_TAG=${{ fromJSON(needs.prepare-docker-build.outputs.psycopg2-json).git_tag }}
|
||||||
VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.psycopg2-json).version }}
|
PSYCOPG2_VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.psycopg2-json).version }}
|
||||||
|
|
||||||
build-pikepdf-wheel:
|
build-pikepdf-wheel:
|
||||||
name: pikepdf
|
name: pikepdf
|
||||||
@ -183,8 +183,8 @@ jobs:
|
|||||||
build-args: |
|
build-args: |
|
||||||
REPO=${{ github.repository }}
|
REPO=${{ github.repository }}
|
||||||
QPDF_VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.qpdf-json).version }}
|
QPDF_VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.qpdf-json).version }}
|
||||||
GIT_TAG=${{ fromJSON(needs.prepare-docker-build.outputs.pikepdf-json).git_tag }}
|
PIKEPDF_GIT_TAG=${{ fromJSON(needs.prepare-docker-build.outputs.pikepdf-json).git_tag }}
|
||||||
VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.pikepdf-json).version }}
|
PIKEPDF_VERSION=${{ fromJSON(needs.prepare-docker-build.outputs.pikepdf-json).version }}
|
||||||
|
|
||||||
build-frontend:
|
build-frontend:
|
||||||
name: Compile frontend
|
name: Compile frontend
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
# Helper script for building the Docker image locally.
|
# Helper script for building the Docker image locally.
|
||||||
# Parses and provides the nessecary versions of other images to Docker
|
# 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
|
# First Argument: The Dockerfile to build
|
||||||
# Other Arguments: Additional arguments to docker build
|
# Other Arguments: Additional arguments to docker build
|
||||||
@ -13,6 +14,14 @@
|
|||||||
|
|
||||||
set -eux
|
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.lock
|
# Parse what we can from Pipfile.lock
|
||||||
pikepdf_version=$(jq ".default.pikepdf.version" Pipfile.lock | sed 's/=//g' | sed 's/"//g')
|
pikepdf_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')
|
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')
|
qpdf_version=$(jq ".qpdf.version" .build-config.json | sed 's/"//g')
|
||||||
jbig2enc_version=$(jq ".jbig2enc.version" .build-config.json | sed 's/"//g')
|
jbig2enc_version=$(jq ".jbig2enc.version" .build-config.json | sed 's/"//g')
|
||||||
# Get the branch name
|
# Get the branch name
|
||||||
frontend=$(git rev-parse --abbrev-ref HEAD)
|
frontend_version=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
if [ ! -f "$1" ]; then
|
# Get Git tags for building
|
||||||
echo "$1 is not a file, please provide the Dockerfile"
|
# psycopg2 uses X_Y_Z git tags
|
||||||
exit 1
|
psycopg2_git_tag=${psycopg2_version//./_}
|
||||||
fi
|
# pikepdf uses vX.Y.Z
|
||||||
|
pikepdf_git_tag="v${pikepdf_version}"
|
||||||
|
|
||||||
docker build --file "$1" \
|
docker build --file "$1" \
|
||||||
--build-arg JBIG2ENC_VERSION="${jbig2enc_version}" \
|
--build-arg JBIG2ENC_VERSION="${jbig2enc_version}" \
|
||||||
--build-arg QPDF_VERSION="${qpdf_version}" \
|
--build-arg QPDF_VERSION="${qpdf_version}" \
|
||||||
--build-arg PIKEPDF_VERSION="${pikepdf_version}" \
|
--build-arg PIKEPDF_VERSION="${pikepdf_version}" \
|
||||||
|
--build-arg PIKEPDF_GIT_TAG="${pikepdf_git_tag}" \
|
||||||
--build-arg PSYCOPG2_VERSION="${psycopg2_version}" \
|
--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}" .
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
# Inputs:
|
# Inputs:
|
||||||
# - REPO - Docker repository to pull qpdf from
|
# - REPO - Docker repository to pull qpdf from
|
||||||
# - QPDF_VERSION - The image qpdf version to copy .deb files from
|
# - QPDF_VERSION - The image qpdf version to copy .deb files from
|
||||||
# - GIT_TAG - The Git tag to clone and build from
|
# - PIKEPDF_GIT_TAG - The Git tag to clone and build from
|
||||||
# - VERSION - Used to force the built pikepdf version to match
|
# - PIKEPDF_VERSION - Used to force the built pikepdf version to match
|
||||||
|
|
||||||
# Default to pulling from the main repo registry when manually building
|
# Default to pulling from the main repo registry when manually building
|
||||||
ARG REPO="paperless-ngx/paperless-ngx"
|
ARG REPO="paperless-ngx/paperless-ngx"
|
||||||
@ -32,7 +32,7 @@ ARG BUILD_PACKAGES="\
|
|||||||
|
|
||||||
WORKDIR /usr/src
|
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
|
# As this is an base image for a multi-stage final image
|
||||||
# the added size of the install is basically irrelevant
|
# the added size of the install is basically irrelevant
|
||||||
@ -49,19 +49,19 @@ RUN set -eux \
|
|||||||
# For better caching, seperate the basic installs from
|
# For better caching, seperate the basic installs from
|
||||||
# the building
|
# the building
|
||||||
|
|
||||||
ARG GIT_TAG
|
ARG PIKEPDF_GIT_TAG
|
||||||
ARG VERSION
|
ARG PIKEPDF_VERSION
|
||||||
|
|
||||||
RUN set -eux \
|
RUN set -eux \
|
||||||
&& echo "building pikepdf wheel" \
|
&& echo "building pikepdf wheel" \
|
||||||
# Note the v in the tag name here
|
# 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 \
|
&& cd pikepdf \
|
||||||
# pikepdf seems to specifciy either a next version when built OR
|
# pikepdf seems to specifciy either a next version when built OR
|
||||||
# a post release tag.
|
# a post release tag.
|
||||||
# In either case, this won't match what we want from requirements.txt
|
# 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
|
# 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
|
# https://github.com/pikepdf/pikepdf/issues/323
|
||||||
&& rm pyproject.toml \
|
&& rm pyproject.toml \
|
||||||
&& mkdir wheels \
|
&& mkdir wheels \
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# This Dockerfile builds the psycopg2 wheel
|
# This Dockerfile builds the psycopg2 wheel
|
||||||
# Inputs:
|
# Inputs:
|
||||||
# - GIT_TAG - The Git tag to clone and build from
|
# - PSYCOPG2_GIT_TAG - The Git tag to clone and build from
|
||||||
# - VERSION - Unused, kept for future possible usage
|
# - PSYCOPG2_VERSION - Unused, kept for future possible usage
|
||||||
|
|
||||||
FROM python:3.9-slim-bullseye
|
FROM python:3.9-slim-bullseye
|
||||||
|
|
||||||
@ -31,13 +31,13 @@ RUN set -eux \
|
|||||||
# For better caching, seperate the basic installs from
|
# For better caching, seperate the basic installs from
|
||||||
# the building
|
# the building
|
||||||
|
|
||||||
ARG GIT_TAG
|
ARG PSYCOPG2_GIT_TAG
|
||||||
ARG VERSION
|
ARG PSYCOPG2_VERSION
|
||||||
|
|
||||||
RUN set -eux \
|
RUN set -eux \
|
||||||
&& echo "Building psycopg2 wheel" \
|
&& echo "Building psycopg2 wheel" \
|
||||||
&& cd /usr/src \
|
&& 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 \
|
&& cd psycopg2 \
|
||||||
&& mkdir wheels \
|
&& mkdir wheels \
|
||||||
&& python3 -m pip wheel . --wheel-dir wheels \
|
&& python3 -m pip wheel . --wheel-dir wheels \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user