Fix: skip postinstall in deps stage, run prisma generate in builder
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user