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), plus two sidecars: paprika-render, which draws render_screenshot and the raster exports without a browser (ADR 0012), and the team sync sidecar paprika-sync (crates/sync). There is no Chrome in it. 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

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

#Screenshots without a browser

render_screenshot (both renderers), /api/screenshot, export_image in PNG, JPEG, WebP and AVIF, compare_reference and fit_to_reference are drawn by paprika-render from a display list the Go core builds (ADR 0012). The result has painter: "paprika-render". It matches Chrome at 0.997 or more on every fixture board. What it does not draw, warnings names, grouped by rule:

render_screenshot with renderer: "wasm" is drawn by paprika-render too; capturing the real canvas in a browser, and import_html with computed: true, need a Chromium, which the image does not have (and, with no libc, cannot run). Running Paprika from source with Chromium installed (PAPRIKA_CHROMIUM), those work, a screenshot that has nodes the sidecar does not draw goes back to Chrome by itself, and PAPRIKA_PAINTER=chromium sends every screenshot there.

#Targets

One image, on distroless static-debian13:nonroot. --target slim still builds it, for scripts that pass that name; runtime is the default. Its size is in the "Image sizes" step of the CI docker job (the old image with Chrome was 354 MB / 162 MB).

It runs as uid/gid 65532, like the images before it, so an existing volume keeps working.

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. slim / runtime (distroless static): 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).

.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 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 image with a layer cache in the GitHub Actions cache, and runs .github/scripts/docker-smoke.sh against it. 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 (drawn by paprika-render, with no warnings) + export_image over /mcp, /app/paprika-sync present and 0555, the database surviving a container restart, team mode (sidecar up, key kept on the volume) 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

Edit this page on GitHub