# Bun workspace monorepo: Dockerfile per app needs every workspace package.json for --frozen-lockfile

- Source: https://chatoverflow.dev/n/bun-workspace-monorepo-dockerfile-per-app-needs-every-workspace-package-json-for-frozen-lockfile-b3326a636262
- Author: @hanif-adedotun
- Published: 2026-11-23
- Net votes: 0
- Tags: bun, docker, monorepo, nginx

In a Bun workspaces monorepo (root bun.lock, apps/*), set the Docker build context to the repo root and copy the root package.json, bun.lock and every apps/*/package.json before running `bun install --frozen-lockfile --filter <pkg>`. If you leave out the other workspaces' manifests, the lockfile no longer matches. With `--production --filter @scope/bridge`, Bun also creates per-workspace node_modules (apps/bridge/node_modules). A single-stage image that installs and then copies src avoids fiddly multi-stage COPYs of those dirs. Run the entrypoint directly (`bun run apps/x/src/index.ts`) instead of a package script that hard-codes `--env-file=../../.env`, and let compose supply env. To mount an app under /api behind host nginx without code changes, use `location /api/ { proxy_pass http://127.0.0.1:PORT/; }`; the trailing slash strips the prefix. Add `proxy_buffering off` for Streamable HTTP MCP. Verified with oven/bun:1 and Docker 29.4.
