Something went wrong. Try again.
Something went wrong. Try again.
corvus.run Dockerfile
2.9 kB · 73 lines
Dockerfile
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374# syntax=docker/dockerfile:1.7
# ---------- build stage ----------# Build @corvus/applier (tsdown → dist/) and @corvus/editor (vite → dist/).# Both outputs are static and get copied verbatim into the runtime image.FROM node:26-slim AS builderENV CI=1RUN npm install -g pnpm@8.15.9
WORKDIR /app
# Manifests first so the install layer caches independently of source edits.COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./COPY packages/applier/package.json packages/applier/COPY packages/client/package.json packages/client/COPY packages/editor/package.json packages/editor/COPY packages/lexicons/package.json packages/lexicons/COPY packages/server/package.json packages/server/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ pnpm install --frozen-lockfile
# Now the source. tsconfig.base.json is needed for the per-package tsconfigs# that extend it.COPY tsconfig.base.json ./COPY packages/applier packages/applierCOPY packages/client packages/clientCOPY packages/editor packages/editorCOPY packages/lexicons packages/lexiconsCOPY packages/server packages/server
# Applier first — the editor build resolves @corvus/applier from its dist.# VITE_ENABLE_SW=1 tells the editor build to emit a service worker so the# deployed SPA keeps working offline after the first load.RUN pnpm --filter @corvus/applier build \ && VITE_ENABLE_SW=1 pnpm --filter @corvus/editor build
# ---------- runtime stage ----------# Slim image with prod-only deps. The server runs TypeScript directly via# Node 26's type-stripping (no compile step for server code).FROM node:26-slim AS runtimeENV NODE_ENV=productionRUN npm install -g pnpm@8.15.9
WORKDIR /app
# Manifests + lockfile so `pnpm install --prod` is reproducible.COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./COPY packages/applier/package.json packages/applier/COPY packages/client/package.json packages/client/COPY packages/editor/package.json packages/editor/COPY packages/lexicons/package.json packages/lexicons/COPY packages/server/package.json packages/server/
# Server runs from TS source. Applier is consumed as a built workspace# package — its package.json `exports` points at ./dist. Editor's dist is# served as static files by the server.COPY packages/server/src packages/server/srcCOPY --from=builder /app/packages/applier/dist packages/applier/distCOPY --from=builder /app/packages/editor/dist packages/editor/dist# Lexicons is bundled into applier/dist already, but pnpm still needs the# workspace package to exist so the @corvus/applier link resolves.COPY packages/lexicons/src packages/lexicons/src
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ pnpm install --frozen-lockfile --prod
ENV CORVUS_DB=/data/ops.db \ CORVUS_STATIC_DIR=/app/packages/editor/dist \ CORVUS_PORT=8787
EXPOSE 8787CMD ["node", "packages/server/src/bin/corvus-server.ts"]