#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
# Standalone unoserver image for Stirling-PDF remote UNO mode.
# Pinned to unoserver 3.7 to match Stirling-PDF's client (avoids wire mismatch).
FROM ubuntu:noble@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852 AS lo-sandbox-build
RUN apt-get update && apt-get install -y --no-install-recommends gcc libc6-dev && \
rm -rf /var/lib/apt/lists/*
COPY docker/base/lo-sandbox.c /src/lo-sandbox.c
RUN gcc -O2 -Wall -Wextra -Werror -o /usr/local/bin/lo-sandbox /src/lo-sandbox.c && \
strip --strip-unneeded /usr/local/bin/lo-sandbox
FROM ubuntu:noble@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852
ARG UNOSERVER_VERSION=3.7
# ~120 MB of CJK fonts — opt-in.
ARG INSTALL_CJK_FONTS=false
# UNOSERVER_IDLE_TIMEOUT_SECONDS=0 keeps idle shutdown off. A positive value only
# works when something sharing /tmp/uno-last-used writes a fresh timestamp (the
# embedded Stirling container does); a standalone unoserver has no wake source
# and would stay stopped while still reporting healthy.
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
UNOSERVER_PORT=2003 \
UNOSERVER_UNO_PORT=2002 \
UNOSERVER_INTERFACE=0.0.0.0 \
UNOSERVER_CONVERSION_TIMEOUT=1800 \
UNOSERVER_RECYCLE_INTERVAL_SECONDS=0 \
UNOSERVER_IDLE_TIMEOUT_SECONDS=0 \
UNOSERVER_PROFILE_DIR=/var/lib/unoserver/profile \
SAL_USE_VCLPLUGIN=svp \
SAL_DISABLE_PRINTERLIST=1 \
OOO_FORCE_DESKTOP=none \
SAL_LOG="-WARN-INFO" \
MALLOC_ARENA_MAX=2 \
DBUS_SESSION_BUS_ADDRESS=/dev/null
RUN set -eux; \
apt-get update; \
apt-get upgrade -y --no-install-recommends; \
apt-get install -y --no-install-recommends \
software-properties-common ca-certificates curl gnupg tini; \
ppa_attempt=1; \
until add-apt-repository -y --no-update ppa:libreoffice/ppa; do \
if [ "${ppa_attempt}" -ge 4 ]; then \
echo "LibreOffice PPA setup failed after ${ppa_attempt} attempts" >&2; \
exit 1; \
fi; \
echo "LibreOffice PPA setup failed; retrying in $((ppa_attempt * 5)) seconds" >&2; \
sleep "$((ppa_attempt * 5))"; \
ppa_attempt=$((ppa_attempt + 1)); \
done; \
apt-get update; \
apt-get install -y --no-install-recommends \
python3 python3-venv python3-uno python3-packaging \
libreoffice-writer-nogui libreoffice-calc-nogui \
libreoffice-impress-nogui libreoffice-draw-nogui \
libreoffice-base-nogui libreoffice-java-common \
xvfb x11-utils coreutils \
fonts-dejavu fonts-liberation fonts-liberation2 \
fonts-crosextra-caladea fonts-crosextra-carlito \
fonts-noto-core fonts-noto-mono fonts-noto-color-emoji \
hyphen-en-gb hyphen-en-us hyphen-fr hyphen-de hyphen-es hyphen-it \
hyphen-pt-pt hyphen-pt-br hyphen-nl hyphen-pl hyphen-ru \
fontconfig \
libcairo2 libpango-1.0-0 libpangoft2-1.0-0 libgdk-pixbuf-2.0-0 \
libfreetype6 libfontconfig1 libx11-6 libxt6 libxext6 libxrender1 \
libxtst6 libxi6 libxinerama1 libxkbcommon0 libsm6 libice6 \
libglib2.0-0; \
if [ "${INSTALL_CJK_FONTS}" = "true" ]; then \
apt-get install -y --no-install-recommends fonts-noto-cjk; \
fi; \
apt-get remove --purge -y software-properties-common; \
apt-get autoremove --purge -y; \
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
# Noble's hyphen-* packages skip LibreOffice registration; wire it up by hand
# or the dicts never load.
RUN set -eu; \
mkdir -p /usr/share/myspell/dicts /usr/share/myspell/infos/ooo; \
for f in /usr/share/hyphen/hyph_*_*.dic; do \
base=$(basename "$f" .dic); \
locale=${base#hyph_}; \
lang=${locale%_*}; \
country=${locale#*_}; \
ln -sfn "../../hyphen/${base}.dic" "/usr/share/myspell/dicts/${base}.dic"; \
printf "HYPH %s %s %s\n" "$lang" "$country" "$base" \
> "/usr/share/myspell/infos/ooo/hyphen-${lang}-${country}"; \
done
COPY --chmod=0644 docker/unoserver/fonts.conf /etc/fonts/conf.d/100-stirling.conf
RUN fc-cache -f
# venv with --system-site-packages so it picks up distro python3-uno.
RUN python3 -m venv /opt/unoserver-venv --system-site-packages && \
/opt/unoserver-venv/bin/pip install --no-cache-dir "unoserver==${UNOSERVER_VERSION}" && \
ln -sf /opt/unoserver-venv/bin/unoserver /usr/local/bin/unoserver && \
ln -sf /opt/unoserver-venv/bin/unoconvert /usr/local/bin/unoconvert && \
ln -sf /opt/unoserver-venv/bin/unoping /usr/local/bin/unoping && \
find /opt/unoserver-venv -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
RUN rm -rf /usr/lib/libreoffice/share/gallery \
/usr/lib/libreoffice/share/template \
/usr/lib/libreoffice/share/wizards \
/usr/lib/libreoffice/help \
/usr/lib/libreoffice/share/extensions/wiki-publisher \
/usr/lib/libreoffice/share/extensions/nlpsolver \
/usr/share/doc/* /usr/share/man/* /usr/share/info/*
COPY --from=lo-sandbox-build /usr/local/bin/lo-sandbox /usr/local/lib/stirling/lo-sandbox
COPY --chmod=0644 docker/base/stirling-hardening.xcd /usr/lib/libreoffice/share/registry/stirling-hardening.xcd
COPY docker/base/unoserver-pipe-transport.py /usr/local/lib/stirling/unoserver-pipe-transport.py
RUN set -eux; \
chown root:root /usr/local/lib/stirling/lo-sandbox; \
chmod 0755 /usr/local/lib/stirling/lo-sandbox; \
for name in /usr/bin/soffice /usr/bin/libreoffice /usr/bin/ooffice; do \
if [ -e "$name" ] || [ -L "$name" ]; then rm -f "$name"; fi; \
cp /usr/local/lib/stirling/lo-sandbox "$name"; \
chown root:root "$name"; \
chmod 0755 "$name"; \
done; \
/opt/unoserver-venv/bin/python /usr/local/lib/stirling/unoserver-pipe-transport.py \
"$(/opt/unoserver-venv/bin/python -c 'import unoserver, os; print(os.path.dirname(unoserver.__file__))')"; \
STIRLING_LO_SANDBOX=off /usr/bin/soffice --version
ARG PUID=1001
ARG PGID=1001
RUN groupadd -g "${PGID}" unoserver && \
useradd -u "${PUID}" -g unoserver -m -d /home/unoserver -s /bin/bash unoserver && \
mkdir -p "${UNOSERVER_PROFILE_DIR}" && \
chown -R unoserver:unoserver "${UNOSERVER_PROFILE_DIR}" /home/unoserver
COPY --chmod=0755 docker/unoserver/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY --chmod=0755 docker/unoserver/healthcheck.sh /usr/local/bin/healthcheck.sh
USER unoserver
WORKDIR /home/unoserver
EXPOSE 2003
HEALTHCHECK --interval=15s --timeout=5s --retries=4 --start-period=45s \
CMD /usr/local/bin/healthcheck.sh
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/entrypoint.sh"]
LABEL org.opencontainers.image.title="Stirling-PDF Unoserver" \
org.opencontainers.image.description="Pinned unoserver build for Stirling-PDF remote UNO mode" \
org.opencontainers.image.source="https://github.com/Stirling-Tools/Stirling-PDF" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.vendor="Stirling-Tools"