Skip to content

Commit eef2a8f

Browse files
junzero741claude
andcommitted
fix(docker): inline prisma.config.js in production stage
Avoids ts-node dependency by writing a simple JS config directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cdb18f7 commit eef2a8f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

apps/backend/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ RUN pnpm nx build backend
2626
# Prune lockfile + copy workspace modules for production install
2727
RUN 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-
3229
# --- Production stage ---
3330
FROM node:20-slim
3431

@@ -44,9 +41,11 @@ COPY --from=builder /app/dist/apps/backend ./
4441
# Install production dependencies only
4542
RUN pnpm install --prod --frozen-lockfile
4643

47-
# Copy Prisma schema + compiled config for runtime migrate
44+
# Copy Prisma schema + migrations for runtime migrate
4845
COPY --from=builder /app/apps/backend/prisma ./prisma
49-
COPY --from=builder /tmp/prisma-config/apps/backend/prisma.config.js ./
46+
47+
# Create prisma.config.js for production (reads DATABASE_URL from env)
48+
RUN echo 'const { defineConfig } = require("prisma/config"); module.exports = defineConfig({ schema: "prisma/schema.prisma", migrations: { path: "prisma/migrations" }, datasource: { url: process.env.DATABASE_URL } });' > prisma.config.js
5049

5150
EXPOSE 4000
5251

0 commit comments

Comments
 (0)