fix: API Dockerfile — re-generate Prisma in pruned deploy dir
Some checks failed
Deploy / Build API Image (push) Failing after 28s
Deploy / Build Web Image (push) Failing after 10s
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 13m29s
Deploy / Build AI Services Image (push) Failing after 13s
E2E Tests / Playwright E2E (push) Failing after 16s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
CI / E2E Tests (push) Has been cancelled

pnpm deploy --legacy doesn't carry .prisma from hoisted node_modules.
Fix: copy prisma schema + run npx prisma generate inside /app/pruned.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ho Ngoc Hai
2026-04-13 23:35:50 +07:00
parent 1c3dd305b8
commit 248378abb8

View File

@@ -35,10 +35,11 @@ RUN npx prisma generate \
&& cd apps/api && npx nest build
# Use pnpm deploy to produce a flat, production-only node_modules
# This strips devDependencies and hoists only what @goodgo/api needs.
# Then re-generate Prisma client inside pruned dir (pnpm deploy doesn't carry .prisma)
RUN pnpm deploy --legacy --filter @goodgo/api --prod /app/pruned \
&& cp -r /app/node_modules/.prisma /app/pruned/node_modules/.prisma \
&& cp -r /app/node_modules/@prisma /app/pruned/node_modules/@prisma
&& cd /app/pruned \
&& cp -r /app/prisma ./prisma \
&& npx prisma generate
# ---- Production ----
FROM node:22-slim AS production