From 39c7c0cb377251ec39a9fc0093da9c35a4eaf72d Mon Sep 17 00:00:00 2001 From: Niels Mokkenstorm Date: Tue, 12 May 2026 00:16:49 +0200 Subject: [PATCH] fix(docker): generate Prisma client in worker prod stage to mirror api The worker production image was bundled via tsup and copied alongside a pnpm install --frozen-lockfile --prod result, but never ran prisma:generate in the prod node_modules context. At runtime the bundled dist/main.js require('@prisma/client') failed with MODULE_NOT_FOUND for .prisma/client/default, sending the worker into CrashLoopBackOff with Exit Code 1. Mirror the api.Dockerfile prod stage: drop the --prod flag on install, copy packages/core/prisma/ and prisma.config.ts, run pnpm --filter @cv/core run prisma:generate. This is a tactical patch. The structural fix is to drop tsup entirely and build via tsc -b project references, which removes this whole class of __dirname / module-resolution issue from both server and worker. --- .docker/worker.Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.docker/worker.Dockerfile b/.docker/worker.Dockerfile index 80a95b8..4507266 100644 --- a/.docker/worker.Dockerfile +++ b/.docker/worker.Dockerfile @@ -78,7 +78,15 @@ COPY .npmrc .npmrc RUN --mount=type=secret,id=github_token,required=true \ NPM_AUTH_TOKEN=$(cat /run/secrets/github_token) \ - pnpm install --frozen-lockfile --prod + pnpm install --frozen-lockfile + +# Copy Prisma schema + config, generate client in prod node_modules context. +# Mirrors api.Dockerfile - the tsup-bundled dist/main.js resolves +# @prisma/client at runtime via require, and that lookup needs the generated +# `.prisma/client/default.js` materialised in node_modules. +COPY packages/core/prisma/ ./packages/core/prisma/ +COPY packages/core/prisma.config.ts ./packages/core/prisma.config.ts +RUN pnpm --filter @cv/core run prisma:generate # Install Chromium + system deps via Playwright RUN cd apps/worker && pnpm exec playwright install --with-deps chromium -- 2.51.2