From 39cbe707c7f6f287ccd289c41c69e10bfa9d8491 Mon Sep 17 00:00:00 2001 From: elpatron Date: Mon, 1 Jun 2026 19:30:53 +0200 Subject: [PATCH] fix(server): Docker build when prisma postinstall runs Copy Prisma schema before npm ci in the builder image and skip postinstall in the production stage since the client is copied from builder. Co-authored-by: Cursor --- server/Dockerfile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/server/Dockerfile b/server/Dockerfile index 10ad1da..8cfcd18 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -3,16 +3,13 @@ FROM node:20-alpine AS builder WORKDIR /app RUN apk add --no-cache openssl libc6-compat -# Copy package configurations +# Copy package configurations and Prisma schema (postinstall runs prisma generate) COPY package*.json ./ +COPY prisma ./prisma # Install all dependencies (including devDependencies for tsc) RUN npm ci -# Copy Prisma schema and generate Client code -COPY prisma ./prisma -RUN npx prisma generate - # Copy source and compile TypeScript COPY src ./src COPY tsconfig.json ./ @@ -26,8 +23,8 @@ RUN apk add --no-cache openssl libc6-compat # Copy package configurations COPY package*.json ./ -# Install only production dependencies -RUN npm ci --omit=dev +# Install only production dependencies (Prisma client copied from builder; skip postinstall) +RUN npm ci --omit=dev --ignore-scripts # Copy generated Prisma Client from builder stage COPY --from=builder /app/node_modules/@prisma/client ./node_modules/@prisma/client