From 3ce39dadbe049c81ff174a86eed8b8e2fc6e2227 Mon Sep 17 00:00:00 2001 From: Michael Wedl Date: Thu, 5 Sep 2024 15:00:05 +0200 Subject: [PATCH 1/3] Use new ghostscript version from debian testing --- CHANGELOG.md | 1 + Dockerfile | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c9eb895e..19e0ec2e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Upcoming * Public note sharing * Add permission Project Admin +* Update ghostscript to fix multiple bugs in pdf post-processing ## v2024.70 - 2024-09-04 diff --git a/Dockerfile b/Dockerfile index 77e346045..6115bf953 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Globally defined ARGS -ARG TESTED_API_IMAGE=undefined_test_image -ARG PROD_API_IMAGE=undefined_prod_image +ARG TESTED_API_IMAGE=api-test +ARG PROD_API_IMAGE=api-prod FROM --platform=$BUILDPLATFORM node:20-alpine3.19 AS pdfviewer-dev @@ -83,7 +83,10 @@ RUN mkdir /src && \ echo "This image distributes binaries of copyleft licensed software. Please find the corresponding source code in our source-code distributing images (append -src to the image tags; e.g. syslifters/sysreptor:2024.58-src)." > /src/SOURCES.txt # Install system dependencies required by weasyprint and chromium -RUN apt-get update && apt-get install -y --no-install-recommends \ +# Install ghostscript from debian testing +RUN echo 'deb http://deb.debian.org/debian trixie main' > /etc/apt/sources.list.d/trixie.list \ + && echo 'APT::Default-Release "stable";' > /etc/apt/apt.conf.d/default-release \ + && apt-get update && apt-get install -y --no-install-recommends \ chromium \ curl \ fontconfig \ @@ -93,7 +96,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ fonts-noto-color-emoji \ fonts-noto-cjk \ fonts-noto-cjk-extra \ - ghostscript \ gpg \ gpg-agent \ libharfbuzz-subset0 \ @@ -102,6 +104,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ unzip \ wget \ postgresql-client \ + && apt-get -t testing install -y --no-install-recommends ghostscript \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -195,7 +198,7 @@ ARG VERSION=dev ENV VERSION=${VERSION} USER 1000 -FROM $TESTED_API_IMAGE AS api-prod +FROM ${TESTED_API_IMAGE} AS api-prod ARG VERSION ENV VERSION=${VERSION} COPY CHANGELOG.md /app/ From a0ca3538b9cb78885172dcca73a78528883aef1b Mon Sep 17 00:00:00 2001 From: Michael Wedl Date: Fri, 6 Sep 2024 08:21:21 +0200 Subject: [PATCH 2/3] Include sources from testing packages --- Dockerfile | 16 +++++++++++----- api/download_sources.sh | 6 +++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6115bf953..8a36d1cae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Globally defined ARGS -ARG TESTED_API_IMAGE=api-test -ARG PROD_API_IMAGE=api-prod +ARG TESTED_API_IMAGE=undefined_test_image_used_in_ci +ARG PROD_API_IMAGE=undefined_prod_image_used_in_ci FROM --platform=$BUILDPLATFORM node:20-alpine3.19 AS pdfviewer-dev @@ -84,7 +84,7 @@ RUN mkdir /src && \ # Install system dependencies required by weasyprint and chromium # Install ghostscript from debian testing -RUN echo 'deb http://deb.debian.org/debian trixie main' > /etc/apt/sources.list.d/trixie.list \ +RUN echo 'Types: deb\nURIs: http://deb.debian.org/debian\nSuites: trixie\nComponents: main\nSigned-By: /usr/share/keyrings/debian-archive-keyring.gpg' > /etc/apt/sources.list.d/testing.sources \ && echo 'APT::Default-Release "stable";' > /etc/apt/apt.conf.d/default-release \ && apt-get update && apt-get install -y --no-install-recommends \ chromium \ @@ -198,14 +198,20 @@ ARG VERSION=dev ENV VERSION=${VERSION} USER 1000 + +# These stages are only used in CI FROM ${TESTED_API_IMAGE} AS api-prod ARG VERSION ENV VERSION=${VERSION} COPY CHANGELOG.md /app/ - FROM ${PROD_API_IMAGE} AS api-src USER 0 RUN dpkg-query -W -f='${binary:Package}=${Version}\n' > /src/post_installed.txt \ && bash /app/api/download_sources.sh -USER 1000 \ No newline at end of file +USER 1000 + + + +# Default stage +FROM api diff --git a/api/download_sources.sh b/api/download_sources.sh index d32ad296b..5f98a4317 100644 --- a/api/download_sources.sh +++ b/api/download_sources.sh @@ -26,7 +26,11 @@ fetch_source() { echo "Fetching $package" mkdir "$package" cd "$package" + # if apt-cache policy "$package" 2>/dev/null | grep '\*\*\*' -A1 | grep trixie; then + # apt-get -t testing source "$package" --download-only > /dev/null 2>&1 + # else apt-get source "$package" --download-only > /dev/null 2>&1 + # fi cd .. echo "Done $package" } @@ -129,7 +133,7 @@ X11 MIT-1" cd /src -sed -i "s/^Types: deb$/Types: deb deb-src/" /etc/apt/sources.list.d/debian.sources +sed -i "s/^Types: deb$/Types: deb deb-src/" /etc/apt/sources.list.d/*.sources apt-get update > /dev/null 2>&1 # Diff with previously installed packages From 246c3d367471cfdd8621dbbe97df3cdae68b00e9 Mon Sep 17 00:00:00 2001 From: Michael Wedl Date: Fri, 6 Sep 2024 08:23:45 +0200 Subject: [PATCH 3/3] Clean up --- api/download_sources.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/api/download_sources.sh b/api/download_sources.sh index 5f98a4317..39bfe136f 100644 --- a/api/download_sources.sh +++ b/api/download_sources.sh @@ -26,11 +26,7 @@ fetch_source() { echo "Fetching $package" mkdir "$package" cd "$package" - # if apt-cache policy "$package" 2>/dev/null | grep '\*\*\*' -A1 | grep trixie; then - # apt-get -t testing source "$package" --download-only > /dev/null 2>&1 - # else apt-get source "$package" --download-only > /dev/null 2>&1 - # fi cd .. echo "Done $package" }