Fix Prisma: force linux-musl-openssl-3.0.x binary + install openssl in runner
This commit is contained in:
14
Dockerfile
14
Dockerfile
@@ -4,16 +4,12 @@
|
||||
|
||||
FROM node:22-alpine AS base
|
||||
|
||||
# Install dependencies only when needed
|
||||
FROM base AS deps
|
||||
RUN apk add --no-cache libc6-compat python3 make g++
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files - skip postinstall (prisma generate runs in builder stage)
|
||||
COPY package*.json ./
|
||||
RUN npm ci --legacy-peer-deps --ignore-scripts
|
||||
|
||||
# Rebuild the source code only when needed
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
@@ -21,17 +17,18 @@ COPY . .
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV NODE_ENV=production
|
||||
# Force Prisma to generate linux-musl-openssl-3.0.x binary (Alpine 3.21 uses OpenSSL 3.x)
|
||||
ENV PRISMA_CLI_BINARY_TARGETS=linux-musl-openssl-3.0.x
|
||||
|
||||
# Generate Prisma Client (schema is available from COPY . .)
|
||||
RUN npx prisma generate
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Production image
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
# Install OpenSSL 3.x so Prisma can load its query engine
|
||||
RUN apk add --no-cache openssl
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
@@ -49,7 +46,6 @@ COPY --from=builder /app/prisma ./prisma
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user