From 12faa996a6168d9994812629c02e36b098b741e0 Mon Sep 17 00:00:00 2001 From: Thomas Leplus Date: Wed, 24 Apr 2024 18:45:20 -0300 Subject: [PATCH] Switch to alpine 3.19.1 (#31) * Switch to pdftk-java to allow alpine upgrade --- pdf/Dockerfile | 18 +++++++++++++++--- pdf/pdftk | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100755 pdf/pdftk diff --git a/pdf/Dockerfile b/pdf/Dockerfile index 68e798e..5ba4695 100644 --- a/pdf/Dockerfile +++ b/pdf/Dockerfile @@ -1,5 +1,4 @@ -# Package pdftk requires alpine 3.8.5 or below -FROM alpine:3.8.5@sha256:2bb501e6173d9d006e56de5bce2720eb06396803300fe1687b58a7ff32bf4c14 +FROM alpine:3.19.1@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b HEALTHCHECK NONE @@ -12,13 +11,26 @@ ARG USER_GECOS=Default # hadolint ignore=DL3018 RUN apk --update --no-cache add \ + curl \ ghostscript \ + jq \ ocrmypdf \ + openjdk21-jre-headless \ pdfgrep \ - pdftk \ qpdf \ && rm -rf /var/cache/apk/* +SHELL ["/bin/ash", "-eo", "pipefail", "-c"] + +RUN VERSION=$(curl -s -S -f https://gitlab.com/api/v4/projects/5024297/releases | jq -r '.[0].tag_name') \ + && mkdir -p /opt/pdftk/lib \ + && curl -s -S -f -o /opt/pdftk/lib/pdftk-all.jar \ + "https://gitlab.com/api/v4/projects/5024297/packages/generic/pdftk-java/${VERSION}/pdftk-all.jar" + +COPY pdftk /usr/bin/pdftk + +RUN chmod 755 /usr/bin/pdftk + RUN adduser \ --home "${USER_HOME}" \ --uid "${USER_ID}" \ diff --git a/pdf/pdftk b/pdf/pdftk new file mode 100755 index 0000000..567aa9c --- /dev/null +++ b/pdf/pdftk @@ -0,0 +1,3 @@ +#!/bin/sh + +java -jar /opt/pdftk/lib/pdftk-all.jar "${@}"