File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ RUN pnpm nx build backend
2626# Prune lockfile + copy workspace modules for production install
2727RUN pnpm nx prune backend
2828
29+ # Compile prisma.config.ts to JS for production (no ts-node needed)
30+ RUN npx tsc apps/backend/prisma.config.ts --module commonjs --esModuleInterop --outDir /tmp/prisma-config
31+
2932# --- Production stage ---
3033FROM node:20-slim
3134
@@ -41,9 +44,9 @@ COPY --from=builder /app/dist/apps/backend ./
4144# Install production dependencies only
4245RUN pnpm install --prod --frozen-lockfile
4346
44- # Copy Prisma schema + config for runtime migrate
47+ # Copy Prisma schema + compiled config for runtime migrate
4548COPY --from=builder /app/apps/backend/prisma ./prisma
46- COPY --from=builder /app/ apps/backend/prisma.config.ts ./
49+ COPY --from=builder /tmp/prisma-config/ apps/backend/prisma.config.js ./
4750
4851EXPOSE 4000
4952
Original file line number Diff line number Diff line change 22dockerfilePath = " apps/backend/Dockerfile"
33
44[deploy ]
5- startCommand = " echo '--- migrate ---' && npx prisma migrate deploy && echo '--- starting node ---' && ls main.js && node main.js"
5+ startCommand = " npx prisma migrate deploy --schema=prisma/schema.prisma && node main.js"
66restartPolicyType = " ON_FAILURE"
You can’t perform that action at this time.
0 commit comments