openpencil/Dockerfile.web-vue
Vitali sharp8n 683a70eace build(web-vue): skip the repo lint gate when building the image
- Build with `build:packages` + the new `build:app` script instead of
  `build`, which also ran oxlint (lint:structure + type-aware oxlint over
  ~2k files): linting is a CI/`bun run check` concern, not an image step
- Removes ~7 s per image build and the fork's pre-existing `max-lines`
  warnings for three upstream files from the w4c deploy log
2026-09-17 23:43:28 +03:00

79 lines
3.2 KiB
Docker

# syntax=docker/dockerfile:1
#
# Dockerfile.web-vue — container for the VUE editor (master, v0.14.0) + MCP.
#
# Replaces the retired Dockerfile.web-rust (Rust web host, main branch). This
# image serves the static SPA build (the same `dist/` artifact that Cloudflare
# Pages deploys for app.openpencil.dev) on :3100 AND the @open-pencil/mcp
# Streamable-HTTP server on :7600, both from one container via the entrypoint.
# w4c-chatapi talks MCP to http://openpencil:7600/mcp (OpenPencilMcp__HttpEndpoint).
#
# Build:
# docker build -f Dockerfile.web-vue -t w4c-openpencil:latest .
#
# Run:
# docker run -p 3100:3100 -p 7600:7600 \
# -e OPENPENCIL_MCP_AUTH_TOKEN=... \
# -e OPENPENCIL_MCP_CORS_ORIGIN=https://openpencil.wiz4chat.com \
# -v openpencil_data:/data \
# w4c-openpencil:latest
# ── Stage 1: builder — bun, install + build the SPA and the MCP packages ─────
FROM oven/bun:1 AS builder
WORKDIR /app
# Lockfile + manifests first for layer caching.
COPY package.json bun.lock bunfig.toml ./
COPY packages/scene-graph/package.json packages/scene-graph/
COPY packages/pen/package.json packages/pen/
COPY packages/kiwi/package.json packages/kiwi/
COPY packages/fig/package.json packages/fig/
COPY packages/core/package.json packages/core/
COPY packages/dom-css/package.json packages/dom-css/
COPY packages/vue/package.json packages/vue/
COPY packages/cli/package.json packages/cli/
COPY packages/mcp/package.json packages/mcp/
COPY packages/harness/package.json packages/harness/
COPY packages/docs/package.json packages/docs/
COPY tools/docs/package.json tools/docs/
RUN bun install --frozen-lockfile
# Full source (excludes heavy local build outputs via .dockerignore).
COPY . .
# Build the workspace packages and the SPA. Deliberately NOT `bun run build`:
# that also runs the repo's oxlint quality gate (`lint:structure` + type-aware
# oxlint over ~2k files). Linting is a CI/`bun run check` concern, not an image
# build step — it added ~7 s and spammed the deploy log with the fork's
# pre-existing `max-lines` warnings for three upstream files.
RUN bun run build:packages && bun run build:app
# Prune to production dependencies so the runtime layer is lean. bun keeps
# workspace symlinks; the MCP server's deps (hono, @modelcontextprotocol/sdk,
# ws, zod + @open-pencil/core) are all in the prod graph.
RUN bun install --production --frozen-lockfile
# ── Stage 2: runtime — static SPA (:3100) + MCP (:7600) ─────────────────────
FROM oven/bun:1-slim AS runtime
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/bun.lock ./bun.lock
COPY --from=builder /app/bunfig.toml ./bunfig.toml
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/packages ./packages
COPY --from=builder /app/docker/static-server.mjs ./static-server.mjs
COPY --from=builder /app/docker/entrypoint.sh /entrypoint.sh
# Writable document root for MCP file-scoped tools (open_file / new_document /
# save_file). Keep on a volume so documents survive container restarts.
ENV OPENPENCIL_MCP_ROOT=/data
EXPOSE 3100 7600
ENTRYPOINT ["/entrypoint.sh"]