diff --git a/api/Dockerfile b/api/Dockerfile index 66db9e3d..21db33f6 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -34,6 +34,28 @@ RUN gcc -O2 -static -o /usr/local/bin/spec-guard /tmp/spec-guard.c \ && gcc -O2 -static -o /usr/local/bin/sandbox-rootfs-setup /tmp/rootfs-setup.c \ && chmod 0111 /usr/local/bin/spec-guard /usr/local/bin/sandbox-rootfs-setup +# ============================================================================ +# Stage 1a: Fetch the pandoc binary (apro-pdf skill needs it on PATH; apt's +# pandoc is stuck on an ancient 2.x, and apt/dpkg are deleted from the final +# image anyway, so grab the upstream static release instead). +# ============================================================================ +FROM buildpack-deps:bookworm-curl AS pandoc-fetch + +ARG PANDOC_VERSION=3.11 +ARG TARGETARCH + +RUN case "$TARGETARCH" in \ + amd64) SHA256=37edb3bbcf722f921a009941bf5874e2e0c09263226c9b4a2d980788cb062ab6 ;; \ + arm64) SHA256=56ed5566ec41d22ec9ee0704e6ac0b98ba102e92384efd5306173a22d314c79a ;; \ + *) echo "unsupported TARGETARCH: $TARGETARCH" >&2; exit 1 ;; \ + esac \ + && curl -fsSL -o /tmp/pandoc.tar.gz \ + "https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-${TARGETARCH}.tar.gz" \ + && echo "${SHA256} /tmp/pandoc.tar.gz" | sha256sum -c - \ + && tar -xzf /tmp/pandoc.tar.gz -C /tmp \ + && mv "/tmp/pandoc-${PANDOC_VERSION}/bin/pandoc" /pandoc \ + && rm -rf /tmp/pandoc.tar.gz "/tmp/pandoc-${PANDOC_VERSION}" + # ============================================================================ # Stage 1b: Build language runtime packages (only consumed by sandbox-runner-baked) # @@ -90,6 +112,11 @@ RUN apt-get update && \ libprotobuf32 \ libffi8 \ ca-certificates \ + # WeasyPrint (apro-pdf skill) needs Pango + a HarfBuzz subsetter at + # runtime; libfontconfig1/fontconfig come in transitively via these. + libpango-1.0-0 \ + libpangoft2-1.0-0 \ + libharfbuzz-subset0 \ && rm -rf /var/lib/apt/lists/* \ && libffi=$(find /usr/lib -name 'libffi.so.8' -print -quit) \ && { [ -n "$libffi" ] || { echo "libffi.so.8 not found" >&2; exit 1; }; } \ @@ -112,6 +139,10 @@ COPY --from=nsjail-builder /nsjail/nsjail /usr/sbin/nsjail COPY --from=nsjail-builder /usr/local/bin/spec-guard /usr/local/bin/spec-guard RUN chmod +x /usr/sbin/nsjail +# pandoc for the apro-pdf skill (document conversion); fetched in the +# pandoc-fetch stage above since apt/bookworm only ships an ancient 2.x. +COPY --from=pandoc-fetch /pandoc /usr/local/bin/pandoc + # The tool-call socket proxy must run under Node, not Bun. Bun's node:http # compat layer never fires `'connection'` events and Bun.serve's idleTimeout # does not close silent unix-socket connections — so our DoS protections diff --git a/docker/package-init.sh b/docker/package-init.sh index 60855b95..ee8bc548 100644 --- a/docker/package-init.sh +++ b/docker/package-init.sh @@ -220,6 +220,8 @@ if [ -f "$PIP_PATH" ]; then pdf2image \ "pdfminer.six" \ reportlab \ + weasyprint==70.0 \ + mermaidx==0.9.5 \ opencv-python-headless \ svglib \ cairosvg \