Use Paprika
Docker
The Dockerfile at the root builds everything Paprika needs into one image: the Go server (MCP over HTTP and stdio, HTTP/WS API, SQLite), the web app (apps/web, with Tailwind) and the Rust/WASM renderer (crates/render); both targets carry the team sync sidecar (crates/sync), and the default one also a headless Chrome (for render_screenshot); slim draws render_screenshot with the render sidecar instead. Nothing else has to be installed on the host.
#Run
docker build -t paprika .
docker run -d --name paprika -p 127.0.0.1:4777:4777 -v paprika-data:/data paprika
# canvas: http://localhost:4777 · MCP: http://localhost:4777/mcpOr with Compose (same settings plus the hardening below, in compose.yaml):
docker compose up -d --buildConnect an agent exactly as with a local server: claude mcp add --transport http paprika http://localhost:4777/mcp.
#Run it hardened
The image is built to run with a read-only root file system and no privileges. compose.yaml already does this; with docker run it is:
docker run -d --name paprika -p 127.0.0.1:4777:4777 -v paprika-data:/data \
--read-only --tmpfs /tmp:size=256m,mode=1777 \
--cap-drop=ALL --security-opt no-new-privileges \
--memory 2g --pids-limit 512 \
paprika- Writable paths: two.
/data(the volume: database, tokens, undo history, team key) and/tmp(Chrome's profile and font cache;HOME=/tmp). Everything else is read-only, and the binaries are0555. - No capabilities. The server binds port 4777 (above 1024) and Chrome runs without its own sandbox (see below), so nothing needs one.
--cap-drop=ALLleavesCapEff/CapBndat zero. - Non-root.
USER 65532:65532in both targets (numeric, so KubernetesrunAsNonRootcan verify it). A bind mount for/datamust belong to that uid:chown 65532:65532 ./data. A named volume is created with the right owner. - Memory and processes. With an empty database, the server uses about 12 MiB. It holds the active workspace in memory, plus the two workspaces read most recently (by a tab or an agent); one left alone for five minutes goes back to the database. A workspace costs much more in memory than on disk: one with 15,000 nodes (2.8 MB of JSON) takes about 75 MiB of Go heap with its undo history.
render_screenshotstarts Chrome on first use and keeps it: about 90 MiB and 70 processes after a first screenshot of a 1600x1200 frame (measured withdocker stats; larger frames need more). That is why the examples allow 2 GiB and 512 pids. In a container, the server gives the Go heap a soft limit of 60% of the memory limit, so the garbage collector works harder before the kernel would kill it.GOMEMLIMIToverrides that limit. Past 80% of it, the server logs a warning, at most every ten minutes. - No shell, no package manager. Neither target has
sh,apt,curlortar(theslimbase is distroless;runtimestarts fromscratch). To look inside a running container usedocker cp/docker export; to debug the data, mount the volume in a throwaway container of your own. Do not add a shell to the image for it. - Stop.
docker stopsendsSIGTERM; the server shuts down by itself (exit code 0, well under a second;tiniforwards the signal inruntime). - Health.
HEALTHCHECKcalls/app/healthcheck, a small static client ofGET /api/health(there is nocurlto call). It checks port 4777; if you move the server (--port 5000), set-e PAPRIKA_HEALTH_PORT=5000(in Compose,healthcheck.test: ["CMD", "/app/healthcheck", "5000"]also works). For one-shot commands (mcp,import,export) pass--no-healthcheck.
#Chrome's sandbox
The server always starts Chrome with --no-sandbox (server/internal/server/screenshot.go, chromedp.NoSandbox): Chrome's own sandbox needs unprivileged user namespaces, which Docker's default seccomp profile forbids. What replaces it here is the container itself: uid 65532, no capabilities, no-new-privileges, a read-only root, memory and pid limits. Chrome only renders HTML that the server generated from the design, and the design's images; if you screenshot designs from people you do not trust, also cut the container's outbound network: render_screenshot works on a docker network create --internal network (checked: it answers and renders with no way out), though a design that points at a remote image then renders without it. Turning Chrome's sandbox back on would take a custom seccomp profile that allows clone(CLONE_NEWUSER) and a switch in the Go code (a PAPRIKA_CHROMIUM_SANDBOX variable is the obvious one); neither exists today.
#Team mode
compose.team.yaml turns on the peer-to-peer team sync (team-sync.md) on top of compose.yaml:
PAPRIKA_TEAM_NAME=Ana docker compose -f compose.yaml -f compose.team.yaml up -d --build- Name.
PAPRIKA_TEAM_NAMEis how the other members see you (defaultpaprika). - Key. The key, the team file, invites and the operation log live in
/data/paprika.team/, in the same volume as the database, so they survivedocker rmand upgrades. Back up the volume: losing the key means being invited again. - Network. The Iroh endpoint binds UDP
4778in the container. From Docker's NAT, peers still reach each other through relays; uncomment the4778:4778/udpport incompose.team.yamlfor direct connections. Only keys on the team's allowlist are accepted, but that port is open to whoever can reach the host. - Which image. The sidecar
paprika-syncis at/app/paprika-syncin both targets (runtimeandslim), soserve --teamworks in either. If the server says it cannot find it in the image, the image is broken or custom. The render sidecarpaprika-render(ADR 0012) sits next to it at/app/paprika-renderin both targets. When Chrome is missing (slim), the server drawsrender_screenshot,/api/screenshot,compare_referenceandfit_to_referencewith it: the result haspainter: "paprika-render", andwarningslists the nodes it does not draw yet (filters, remote, GIF and SVG images, text outside Inter, see the fallback rules in the ADR). With Chrome present, Chrome still draws them. - Back to local.
docker compose up -d(without the second file) starts the server without--team; the team data stays in the volume.
#Data, port, exposure
- Data. The SQLite database is
/data/paprika.dbinside the container (PAPRIKA_DB);/datais a volume, so documents, tokens and the undo/redo history survivedocker rmand image upgrades. Back it up withpaprika export(below) or by copying the volume. - Port. Keep the host port at 4777. The server only accepts requests whose
Host/Originislocalhost:4777,127.0.0.1:4777or[::1]:4777(its DNS-rebinding protection: a web page you visit cannot make your browser talk to a Paprika on another name), so-p 8080:4777answers403. To use another port, change both sides and the server's:-p 127.0.0.1:5000:5000 paprika serve --host 0.0.0.0 --port 5000(and the health check, above). - Exposure. Inside the container the server binds
0.0.0.0(it has to, for Docker's port forwarding). Publish it on the host's loopback (127.0.0.1:4777:4777, as above) unless you mean to share it: there is no authentication. - Variables.
PAPRIKA_DB(/data/paprika.db),PAPRIKA_WEB_ROOT(/app/web),PAPRIKA_CHROMIUM(/opt/chrome/chrome-headless-shell,runtimeonly),PAPRIKA_SYNC(/app/paprika-syncis found next to the binary),PAPRIKA_RENDER(/app/paprika-render, found the same way),HOME=/tmp.PAPRIKA_WEB_FONTS=offstopsrender_screenshotfrom fetching Google Fonts (below).PAPRIKA_MCP_TOKEN(empty by default;compose.yamlpasses it through) makes/mcprequireAuthorization: Bearer <token>(mcp).
#Import, export and stdio
The image's entrypoint is the paprika CLI, so every command works with the same volume:
# import a .paprika.json into the volume's database
docker run --rm -i --no-healthcheck -v paprika-data:/data paprika import /dev/stdin < packages/e2e/fixtures/demo.paprika.json
# export the active workspace (stdout)
docker run --rm --no-healthcheck -v paprika-data:/data paprika export > design.paprika.json
# list workspaces
docker run --rm --no-healthcheck -v paprika-data:/data paprika listFor agents that only speak stdio:
{
"mcpServers": {
"paprika": {
"command": "docker",
"args": ["run", "-i", "--rm", "--no-healthcheck", "--read-only", "--cap-drop=ALL", "-v", "paprika-data:/data", "paprika", "mcp", "--no-ui"]
}
}
}Stop the HTTP container first if both would write to the same volume at once.
#Targets
| Target | Base | Size (layers / compressed) | render_screenshot |
Team mode |
|---|---|---|---|---|
runtime (default) |
scratch + the files Chrome and tini load (no shell, no package manager) |
354 MB / 162 MB | yes | yes |
slim |
distroless static-debian13:nonroot |
not re-measured since paprika-sync was added (it was 54 MB / 20 MB without it): see the "Image sizes" step of the CI docker job |
yes, drawn by paprika-render (shapes and Inter text; what it cannot draw yet is listed in warnings) |
yes |
Measured with docker history (sum of the layers) and docker save | gzip | wc -c; before this rewrite the same images were 757 MB / 290 MB and 83 MB / 31 MB. The runtime row already includes the sidecar; slim grows by the size of the static paprika-sync binary. The machine was a shared 4-core one, so treat timings as orders of magnitude.
docker build --target slim -t paprika:slim .Both run as uid/gid 65532, so a volume can move between them.
Labels (org.opencontainers.image.source, .licenses, .version, .revision, .created) come from build arguments: docker build --build-arg VERSION=1.2.3 --build-arg REVISION=$(git rev-parse HEAD) . (Compose reads PAPRIKA_VERSION and PAPRIKA_REVISION). VERSION also sets the binary's version (paprika --version, MCP serverInfo.version); without it both say dev. Cutting a release: releases.
#How the image is built
# syntax=docker/dockerfile:1, BuildKit. The stages are independent, so the Rust, Go and Node builds run in parallel; each splits "dependencies" from "our code" so an edit to a source file rebuilds only the last step:
- wasm (
rust):cargo build --release --target wasm32-unknown-unknown+wasm-bindgen(release binary, checksum-pinned, same version and checksum as.github/actions/setup-rust-wasm). Dependencies compile first against an empty crate (a layer keyed byCargo.toml/Cargo.lock/.cargo/config.toml, which turns on WASM SIMD), then the crate itself. The stage fails ifWASM_BINDGEN_VERSIONdiffers from the=pin incrates/render/Cargo.toml. - sync (
rust+musl-tools): the sidecarpaprika-sync, a static musl binary with symbols stripped and build paths remapped (through cargo's environment, notCargo.toml), same dependency split. render (rust+musl-tools): the render sidecarpaprika-render(--features server), built the same way;build.rscompilesproto/render/v1/render.protowithprotox, so noprotocis needed. - web (
node, pnpm frompackageManager, checked):pnpm install --frozen-lockfile --ignore-scripts --filter @paprika/web...with the pnpm store in a cache mount, thenpackages/corebuild andvite buildwith the WASM from stage 1 copied toapps/web/src/wasm. It checks thatdist/client/_shell.htmland a.wasmexist. - server (
golang): modules in one layer, the compiled third-party packages in the next (their list comes fromgo list -deps), then the server itself;CGO_ENABLED=0 -tags nodynamic -trimpath -ldflags "-s -w"(modernc.org/sqliteis pure Go; webp/avif stay on WASM so purego does not pull libc). A cache mount seeded from that layer keeps local rebuilds at a few seconds. The healthcheck client is a small program written out in the same Dockerfile. - rootfs (
ubuntu): the packages Chrome links against, reduced to the files the headless shell loads: the closurelddreports for the binary, its libraries andtini, NSS's modules, fontconfig's configuration, the fonts (see below; the same Inter TTFs the server embeds, instead of Ubuntu'sfonts-inter), the CA bundle, andstatus.dpackage metadata so image scanners can see what is inside. Chrome comes from Chrome for Testing's headless shell (the build Playwright uses inpackages/e2e, checksum-pinned) without its 200+ UI locales (en-USstays). - runtime / slim: binary at
/app/paprika(and/app/paprika-syncnext to it, found byserve --team, and/app/paprika-render), canvas at/app/web(PAPRIKA_WEB_ROOT), headless shell at/opt/chrome(PAPRIKA_CHROMIUM).runtimestartsFROM scratch.
Fonts in runtime. render_screenshot draws text with what is installed, and a glyph with no font is drawn as nothing, not as a box. The image carries Inter, Liberation (Latin, Greek, Cyrillic, Hebrew; also the serif and monospace fallbacks), Noto Color Emoji, Droid Sans Fallback (Chinese and Japanese ideographs and kana, 4.0 MB), and Noto Sans Regular and Bold for Arabic, Devanagari and Thai (six files, about 1.1 MB; the rest of fonts-noto-core, 42 MB, is installed in the rootfs stage but not copied). Together this is 5.1 MB more in the layers (about 2.6 MB compressed) than the image without the last three groups. Not built in: Korean Hangul and other scripts (Bengali, Tamil, Georgian, Armenian and so on) render blank in the default fonts. The smoke test fails if Latin, Chinese/Japanese, Arabic, Devanagari or Thai text renders blank. To add a script to the image, install its font package in the rootfs stage and add its files to the cp --parents line there.
Google Fonts. Instead of growing the image, render_screenshot fetches the families a design names (fontFamily: "Noto Sans KR", "Lobster") from Google Fonts before the capture, only the weights the text uses and only the unicode-range subsets that cover its characters, and inlines them into the page Chrome renders. The CSS and the font files are cached in /data/font-cache (next to the database; from source, next to --db), so the next screenshot needs no network. Only fonts.googleapis.com (the CSS) and fonts.gstatic.com (the files, over HTTPS) are contacted, with an 8 s budget per screenshot. A family that Google Fonts does not have, or that cannot be fetched (offline, a docker network create --internal network, a firewall), falls back to the built-in fonts, the result lists it in warnings, and the server does not try that family again for 10 minutes. PAPRIKA_WEB_FONTS=off turns the fetch off. The smoke test renders Korean in Noto Sans KR this way, and skips that check when the runner is offline.
.dockerignore is an allowlist: the build context only carries what the stages copy (tests, test fixtures and the other apps stay out, so editing them never invalidates a layer). The context is 5.6 MB.
Base images and downloads are pinned: every FROM is name:tag@sha256:digest; wasm-bindgen, Chrome and pnpm (the npm tarball) are ADD --checksum.
#Keeping the pins up to date
- Base image digests. Dependabot (
dockerecosystem in.github/dependabot.yml) updates the tag and the digest in theFROMlines together. By hand:docker buildx imagetools inspect <image>:<tag> --format '{{.Manifest.Digest}}', then replace the@sha256:part. - Overriding a base (a mirror, an internal registry, a CA injected for a proxy): the name to override is the full pinned reference:
docker buildx build --build-context rust:1.100-slim-trixie@sha256:<digest>=docker-image://<other> . - Chrome and Playwright. Playwright in
packages/e2e→CHROME_VERSIONand the checksum in thechrome-zipstage (browserVersionofchromium-headless-shellin playwright-core'sbrowsers.json; the checksum iscurl -sL <zip url> | sha256sum). The server refuses a Chromium build other than the one Playwright expects, so these two move together. - wasm-bindgen.
wasm-bindgen = "=…"incrates/render/Cargo.toml→WASM_BINDGEN_VERSIONand its checksum in thewasm-bindgen-tgzstage and in.github/actions/setup-rust-wasm(the build checks the first two against each other; Dependabot ignores that crate). - pnpm.
packageManagerinpackage.json→PNPM_VERSIONand the checksum in thepnpm-tgzstage (the build fails if the version differs; the checksum iscurl -sL https://registry.npmjs.org/pnpm/-/pnpm-<version>.tgz | sha256sum). - Go. The
golang:tag must be at least thegoline ofserver/go.mod(GOTOOLCHAIN=localstops the toolchain from downloading another one). - Node. The
node:tag follows theenginesfloor and what CI uses. - Ubuntu packages.
aptinstalls the current versions from the pinned Ubuntu image's archive at build time (DL3008 is ignored on purpose): rebuild to pick up security fixes, and re-scan.
#CI
The docker job of .github/workflows/ci.yml lints the Dockerfile with hadolint, builds the default target and slim with a layer cache in the GitHub Actions cache, and runs .github/scripts/docker-smoke.sh against each. The smoke test runs the image hardened (--read-only --cap-drop=ALL --security-opt no-new-privileges, memory and pid limits) and checks: numeric non-root user, no shell, the HEALTHCHECK turning healthy, no capabilities left, the canvas and WASM asset served, foreign Host refused, MCP initialize + tools/list + create_nodes + render_screenshot over /mcp (including that Latin, Chinese/Japanese, Arabic, Devanagari and Thai text is not blank), /app/paprika-sync present and 0555, the database surviving a container restart, team mode (sidecar up, key kept on the volume; the slim run does the same, without render_screenshot) and a clean docker stop in under 8 seconds. It runs when the PR touches the Dockerfile, .dockerignore, compose.yaml, or anything that goes into the image (server/, apps/web/, crates/render/, crates/sync/, packages/core/), plus on full runs. See ci.md.
Run the same checks locally (the port must be 4777):
docker build -t paprika:dev . && .github/scripts/docker-smoke.sh paprika:dev
docker build --target slim -t paprika:slim . && SCREENSHOT=sidecar .github/scripts/docker-smoke.sh paprika:slim