From c7c35034d01d9f4fa5c54074e06fbe06f44e2d5f Mon Sep 17 00:00:00 2001 From: Ludy87 Date: Wed, 12 Nov 2025 14:41:30 +0100 Subject: [PATCH] Update LibreOffice installation in Dockerfile Replaces manual extraction and symlink creation for LibreOffice with a dpkg-based installation. Adds dpkg to dependencies and improves handling of LibreOffice binaries and symlinks for better compatibility. --- Dockerfile.fat | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Dockerfile.fat b/Dockerfile.fat index ca668b287..3b8995311 100644 --- a/Dockerfile.fat +++ b/Dockerfile.fat @@ -25,11 +25,6 @@ RUN ./gradlew clean build -x spotlessApply -x spotlessCheck -x test -x sonarqube FROM alpine:3.22.2@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 ADD https://download.documentfoundation.org/libreoffice/stable/25.2.6/deb/x86_64/LibreOffice_25.2.6_Linux_x86-64_deb.tar.gz /tmp/lo.tar.gz -RUN mkdir -p /opt/libreoffice && \ - tar -xzf /tmp/lo.tar.gz -C /opt/libreoffice --strip-components=1 && \ - rm -f /tmp/lo.tar.gz && \ - ln -sf /opt/libreoffice/program/soffice /usr/bin/soffice.bin && \ - chmod 755 /usr/bin/soffice.bin # Copy necessary files COPY scripts /scripts @@ -84,7 +79,8 @@ RUN --mount=type=cache,target=/var/cache/apk \ su-exec \ openssl \ openssl-dev \ - openjdk21-jre + openjdk21-jre \ + dpkg RUN --mount=type=cache,target=/var/cache/apk \ apk add --no-cache \ @@ -129,6 +125,21 @@ RUN --mount=type=cache,target=/var/cache/apk \ # Calibre fixes apk fix --no-cache calibre +RUN set -eux; \ + mkdir -p /tmp/libreoffice && \ + tar -xzf /tmp/lo.tar.gz -C /tmp/libreoffice --strip-components=1 && \ + for pkg in /tmp/libreoffice/DEBS/*.deb; do \ + dpkg-deb -x "${pkg}" /; \ + done && \ + libreoffice_dir="$(find /opt -maxdepth 1 -type d -name 'libreoffice*' | head -n 1)" && \ + [ -n "${libreoffice_dir}" ] && \ + rm -f /opt/libreoffice && \ + ln -sf "${libreoffice_dir}" /opt/libreoffice && \ + rm -f /usr/bin/soffice /usr/bin/soffice.bin && \ + ln -sf /opt/libreoffice/program/soffice /usr/bin/soffice && \ + ln -sf /opt/libreoffice/program/soffice.bin /usr/bin/soffice.bin && \ + rm -rf /tmp/libreoffice /tmp/lo.tar.gz + RUN python3 -m venv /opt/venv && \ /opt/venv/bin/pip install --no-cache-dir --upgrade pip setuptools && \ /opt/venv/bin/pip install --no-cache-dir --upgrade unoserver weasyprint && \