From cbf7c725e38db15d3165971ea54568015389bbc4 Mon Sep 17 00:00:00 2001 From: Simon Abler Date: Wed, 11 Mar 2026 17:13:25 +0000 Subject: [PATCH] fix(docker): install fontconfig + ttf-dejavu to silence Sharp/libvips warning node:24-alpine has no Fontconfig installation. When Sharp composites an SVG overlay that contains elements, libvips internally calls into librsvg/Pango to render it. Pango uses Fontconfig to locate system fonts; without a Fontconfig config file the process prints: Fontconfig error: Cannot load default config file: No such file: (null) This is non-fatal (the SVG is still rendered with a fallback glyph set) but it floods the container log on every watermark/text request. Fix: install fontconfig and ttf-dejavu (a standard, complete free font family covering Latin, Greek, Cyrillic, etc.) in the runtime stage, then rebuild the font cache with fc-cache -f so Fontconfig finds the config file. ttf-dejavu is chosen because: - Available in Alpine apk with no extra repos - Covers the most common scripts users will embed in watermarks - Small (~1 MB compressed) --- dockerfiles/Dockerfile.backend | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dockerfiles/Dockerfile.backend b/dockerfiles/Dockerfile.backend index 5bd377d..cbc6f9b 100644 --- a/dockerfiles/Dockerfile.backend +++ b/dockerfiles/Dockerfile.backend @@ -19,7 +19,10 @@ FROM node:24-alpine AS runtime ENV NODE_ENV=production RUN apk update && apk upgrade -RUN apk add --no-cache python3 make g++ sqlite-dev py3-setuptools +RUN apk add --no-cache python3 make g++ sqlite-dev py3-setuptools \ + # Fontconfig + fonts — required by libvips/Sharp for SVG text rendering \ + fontconfig ttf-dejavu && \ + fc-cache -f