Files
docmost-sync/Dockerfile
vvzvlad 447d2508ae feat(sync): scaffold monorepo, extract docmost-client, add Phase-0 harness + read-only pull
Lock the access-layer decision (REST only) and start implementation per SPEC.

- monorepo (npm workspaces): packages/docmost-client = DocmostClient + lib/*
  copied 1:1 from docmost-mcp/src (backport target), plus bannered sync methods
  (listTrash, restorePage, listAllSpacePages, exportPageBody, listRecentSince /
  collectRecentSince cursor scan)
- engine stays the root app per AGENTS.md (src/, test/, build/, data/, settings.ts);
  add roundtrip.ts (SPEC §11 idempotency harness), pull.ts (SPEC §6 read-only
  Docmost->FS mirror), sanitize.ts (SPEC §12 filenames, path-traversal-safe)
- Dockerfile builds the workspace lib before the app; vitest gates CI
- exportPageBody never touches /comments (SPEC §3); serializeDocmostMarkdownBody
  emits meta + body only
- SPEC: resolve access-layer (REST), reflect root-engine layout + REST pagination
- tests: sanitize (incl. dot-traversal), collectRecentSince (cutoff/dedup/cap),
  stripBlockIds, markdown round-trip byte-stability

Note: raw ProseMirror round-trip is byte-stable in Markdown but not yet attribute-
idempotent (SPEC §11 Задача №0, before Phase 2).
2026-06-16 20:20:20 +03:00

24 lines
713 B
Docker

FROM node:22-slim
WORKDIR /app
# Dependencies first (better layer caching): copy the root manifest, the lock,
# and the workspace package manifest so `npm ci` can link the workspace.
COPY package.json package-lock.json ./
COPY packages/docmost-client/package.json packages/docmost-client/package.json
RUN npm ci
# Runtime state directory (mounted as a volume in production).
RUN mkdir -p data
# Source + TS config, then build the workspace lib and compile the app to build/.
COPY tsconfig.json tsconfig.base.json ./
COPY packages/ packages/
COPY src/ src/
RUN npm run build
# Drop dev dependencies (typescript, tsx, vitest) to slim the runtime image.
RUN npm prune --omit=dev
CMD ["node", "build/index.js"]