Skip to content

Commit 6d667d1

Browse files
authored
SEP-1003: Install WeasyPrint system libraries in Docker runtime image (#554)
## Summary - Add `pango`, `fontconfig`, and `ttf-dejavu` to the runtime stage's `apk add` line in `Dockerfile`. `pango` transitively pulls in `glib` (which provides `libgobject-2.0-0`), `harfbuzz`, `cairo`, `fribidi` and bundles `libpangoft2`, satisfying every shared library WeasyPrint loads at import time. - Add a `changelog.d/SEP-1003.fixed.md` fragment under "Fixed". - Builder stage is intentionally untouched; it already builds the `weasyprint` wheel without needing any of these runtime libraries. Verified end-to-end on `python:3.11.14-alpine` that the chosen package set lets `from weasyprint import CSS, HTML` succeed at import time and that `HTML(...).write_pdf()` produces a valid PDF. Image size grows by roughly 30-40 MB; this is unavoidable for WeasyPrint to function. ## Tested - [x] `docker compose build` completes successfully. - [x] `docker compose up` boots without the `libgobject-2.0-0` OSError; both `app_1` and `celery_worker` reach a healthy state. - [x] Trigger a PDF report via the report plugin and confirm the resulting PDF opens in a viewer with real text glyphs (not empty rectangles). ## Checklist - [x] ~~New/modified functions have type hints and rST docstrings~~ *(N/A — Dockerfile-only change)* - [x] ~~New tests added for new features or bug fixes~~ *(N/A — runtime-dep fix verified via container boot + PDF smoke test)* - [x] ~~Database migrations generated if models changed (`make makemigrations`)~~ *(N/A — no model changes)* - [x] ~~User-facing changes documented (README, inline help, UI text)~~ *(N/A — internal runtime fix; changelog fragment added)* - [x] ~~Configuration changes documented with examples~~ *(N/A — no configuration changes)*
1 parent 1374802 commit 6d667d1

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ENV FASTAPI_ENV production_docker
1717
FROM docker.io/library/python:3.11.14-alpine
1818

1919
# Install dependencies
20-
RUN apk update && apk add --no-cache g++
20+
RUN apk update && apk add --no-cache g++ pango fontconfig ttf-dejavu
2121

2222
# Create the sep system user
2323
RUN addgroup --gid 1001 -S sep && \

changelog.d/SEP-1003.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Docker image now boots: install WeasyPrint system libraries (pango, fontconfig, ttf-dejavu) in the runtime image

0 commit comments

Comments
 (0)