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.
This commit is contained in:
Ludy87
2025-11-12 14:41:30 +01:00
parent 90e4bc806f
commit c7c35034d0

View File

@@ -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 && \