Fix: skip postinstall in deps stage, run prisma generate in builder

This commit is contained in:
2026-02-17 23:51:28 +00:00
parent 50cbcb1634
commit 54811b8247

View File

@@ -9,12 +9,9 @@ FROM base AS deps
RUN apk add --no-cache libc6-compat python3 make g++
WORKDIR /app
# Copy package files AND prisma schema (needed for postinstall: prisma generate)
# Copy package files only - skip postinstall scripts (prisma generate runs in builder stage)
COPY package*.json ./
COPY prisma ./prisma/
# Install dependencies (with legacy peer deps for compatibility)
RUN npm ci --legacy-peer-deps
RUN npm ci --legacy-peer-deps --ignore-scripts
# Rebuild the source code only when needed
FROM base AS builder
@@ -26,7 +23,7 @@ COPY . .
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
# Generate Prisma Client (needs schema but not DATABASE_URL yet)
# Generate Prisma Client (schema is now available from COPY . .)
RUN npx prisma generate
# Build the application (DATABASE_URL will be available via Coolify env vars)
@@ -58,3 +55,4 @@ EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"