PaprikaPaprikaDocs
HomeGitHubPortuguês

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

bash
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/mcp

Or with Compose (same settings plus the hardening below, in compose.yaml):

bash
docker compose up -d --build

Connect 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:

bash
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

#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:

bash
PAPRIKA_TEAM_NAME=Ana docker compose -f compose.yaml -f compose.team.yaml up -d --build

#Data, port, exposure

#Import, export and stdio

The image's entrypoint is the paprika CLI, so every command works with the same volume:

bash
# 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 list

For agents that only speak stdio:

json
{
  "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.

bash
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:

  1. 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 by Cargo.toml/Cargo.lock/.cargo/config.toml, which turns on WASM SIMD), then the crate itself. The stage fails if WASM_BINDGEN_VERSION differs from the = pin in crates/render/Cargo.toml.
  2. sync (rust + musl-tools): the sidecar paprika-sync, a static musl binary with symbols stripped and build paths remapped (through cargo's environment, not Cargo.toml), same dependency split. render (rust + musl-tools): the render sidecar paprika-render (--features server), built the same way; build.rs compiles proto/render/v1/render.proto with protox, so no protoc is needed.
  3. web (node, pnpm from packageManager, checked): pnpm install --frozen-lockfile --ignore-scripts --filter @paprika/web... with the pnpm store in a cache mount, then packages/core build and vite build with the WASM from stage 1 copied to apps/web/src/wasm. It checks that dist/client/_shell.html and a .wasm exist.
  4. server (golang): modules in one layer, the compiled third-party packages in the next (their list comes from go list -deps), then the server itself; CGO_ENABLED=0 -tags nodynamic -trimpath -ldflags "-s -w" (modernc.org/sqlite is 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.
  5. rootfs (ubuntu): the packages Chrome links against, reduced to the files the headless shell loads: the closure ldd reports for the binary, its libraries and tini, NSS's modules, fontconfig's configuration, the fonts (see below; the same Inter TTFs the server embeds, instead of Ubuntu's fonts-inter), the CA bundle, and status.d package metadata so image scanners can see what is inside. Chrome comes from Chrome for Testing's headless shell (the build Playwright uses in packages/e2e, checksum-pinned) without its 200+ UI locales (en-US stays).
  6. runtime / slim: binary at /app/paprika (and /app/paprika-sync next to it, found by serve --team, and /app/paprika-render), canvas at /app/web (PAPRIKA_WEB_ROOT), headless shell at /opt/chrome (PAPRIKA_CHROMIUM). runtime starts FROM 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

#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):

bash
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

Edit this page on GitHub