Files
docmost-sync/Dockerfile
vvzvlad ec0a3d47c7 fix(sync): robust git coupling — non-ASCII paths, config neutralization, runtime git
Address git-integration fragility (output is not parsed for control flow; we rely
on exit codes + plumbing — but porcelain BEHAVIOR is config-sensitive, and the
runtime image lacked git).

- listTrackedFiles: `git -c core.quotepath=false ls-files -z` + NUL split — fixes
  Cyrillic/UTF-8 vault filenames being returned octal-escaped/quoted
- Dockerfile: install git (node:22-slim ships none; the daemon shells out at runtime)
- VaultGit env: LC_ALL=C/LANG=C, GIT_PAGER=cat, GIT_TERMINAL_PROMPT=0; keep
  stripping GIT_DIR/GIT_WORK_TREE (cwd-isolation, §12)
- ensureRepo local config: core.autocrlf=false + core.safecrlf=false (protect §11
  byte-stability from a global autocrlf=true), commit.gpgsign=false, and
  core.attributesFile=/dev/null (neutralize a global clean/smudge filter that
  would rewrite the stored blob); commit uses --no-verify (skip injected hooks)
- assertGitAvailable() preflight: clear error if the git binary is missing
- tests: Cyrillic listTrackedFiles, LF byte-preservation of the stored blob,
  local-config neutralization incl. attributesFile (590+ green)
2026-06-17 00:15:17 +03:00

31 lines
1.1 KiB
Docker

FROM node:22-slim
WORKDIR /app
# The daemon shells out to the system `git` binary at runtime (git is the vault
# state store), but node:22-slim does NOT ship git. Install it and KEEP it in
# the final image. Placed before `npm ci` so this layer caches across rebuilds.
# `npm prune --omit=dev` below cannot remove this — it is an OS package, not an
# npm dependency.
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
# 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"]