fix(worker): corrige le build Docker de tech-step-llm-worker

docker compose build tech-step-llm-worker échouait sur deux problèmes
en cascade, tous deux liés à l'isolation volontaire de ce service hors
du monorepo pnpm (seul son propre package.json/tsconfig.json est copié
dans son contexte de build) :

- pnpm install --ignore-workspace --frozen-lockfile échouait
  (ERR_PNPM_IGNORED_BUILDS) : sans "packageManager" dans son
  package.json, corepack télécharge le pnpm le plus récent
  (11.22.0), qui a durci en erreur bloquante ce qui n'était qu'un
  avertissement sur les builds de dépendances ignorés
  (esbuild/node-llama-cpp). Le reste du repo est épargné parce que
  apps/api/Dockerfile copie le package.json racine, qui pinne déjà
  pnpm@10.12.4 — ce pin ne pouvait pas atteindre ce service isolé.
  Fixé en pinnant la même version ici.
- tsc échouait ensuite (TS5083 puis erreurs en cascade dans les .d.ts
  de node-llama-cpp) : tsconfig.json de ce service extends le
  tsconfig.base.json racine (skipLibCheck notamment), jamais copié
  dans le contexte de build. Fixé en le copiant avant tsconfig.json.

Vérifié : `docker compose build tech-step-llm-worker` complet en local.
This commit is contained in:
Nicolas 2026-08-22 12:30:27 +02:00
parent ecf236c1a4
commit 1d69a61b37
2 changed files with 5 additions and 0 deletions

View file

@ -21,6 +21,10 @@ FROM base AS build
# different versions than what's on disk/CI. # different versions than what's on disk/CI.
COPY services/tech-step-llm-worker/package.json services/tech-step-llm-worker/pnpm-lock.yaml ./ COPY services/tech-step-llm-worker/package.json services/tech-step-llm-worker/pnpm-lock.yaml ./
RUN pnpm install --ignore-workspace --frozen-lockfile RUN pnpm install --ignore-workspace --frozen-lockfile
# tsconfig.json `extends` the repo-root base config (shared with every
# other package's own tsconfig) — must be copied in alongside it, or `tsc`
# fails outright (TS5083) before it ever reaches src.
COPY tsconfig.base.json ../tsconfig.base.json
COPY services/tech-step-llm-worker/tsconfig.json ./tsconfig.json COPY services/tech-step-llm-worker/tsconfig.json ./tsconfig.json
COPY services/tech-step-llm-worker/src ./src COPY services/tech-step-llm-worker/src ./src
RUN pnpm exec tsc -p tsconfig.json RUN pnpm exec tsc -p tsconfig.json

View file

@ -3,6 +3,7 @@
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"type": "module", "type": "module",
"packageManager": "pnpm@10.12.4",
"description": "Standalone scheduled worker — periodically audits low-confidence tech-step NLP matches and transforms user corrections into TechStepTrainingSuggestion rows, both via a local LLM (node-llama-cpp). Talks to apps/api exclusively through /internal/tech-steps/* (no direct DB access, no Prisma client of its own). Deliberately outside the pnpm monorepo workspace (pnpm-workspace.yaml only covers apps/*/packages/*) — same reasoning as experiments/llm-tech-step-poc: node-llama-cpp's native binding must never be compiled as part of apps/api's own install/Docker build.", "description": "Standalone scheduled worker — periodically audits low-confidence tech-step NLP matches and transforms user corrections into TechStepTrainingSuggestion rows, both via a local LLM (node-llama-cpp). Talks to apps/api exclusively through /internal/tech-steps/* (no direct DB access, no Prisma client of its own). Deliberately outside the pnpm monorepo workspace (pnpm-workspace.yaml only covers apps/*/packages/*) — same reasoning as experiments/llm-tech-step-poc: node-llama-cpp's native binding must never be compiled as part of apps/api's own install/Docker build.",
"scripts": { "scripts": {
"start": "tsx src/index.ts", "start": "tsx src/index.ts",