Switch to Debian-based Node image for Prisma compatibility

- Change from node:20-alpine to node:20-slim
- Fixes OpenSSL library compatibility issues with Prisma
- Debian has better support for Prisma's binary engines
This commit is contained in:
2025-12-02 12:32:23 +00:00
parent 9ebb2786b3
commit f1cbd88761

View File

@@ -1,9 +1,9 @@
# Use Node.js LTS version
FROM node:20-alpine AS base
FROM node:20-slim AS base
# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat openssl
RUN apt-get update && apt-get install -y openssl ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package files
@@ -12,12 +12,12 @@ RUN npm ci
# Rebuild the source code only when needed
FROM base AS builder
RUN apk add --no-cache openssl
RUN apt-get update && apt-get install -y openssl ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Generate Prisma Client for Alpine Linux
# Generate Prisma Client
RUN npx prisma generate
# Build Next.js application
@@ -26,7 +26,7 @@ RUN npm run build
# Production image, copy all the files and run next
FROM base AS runner
RUN apk add --no-cache openssl
RUN apt-get update && apt-get install -y openssl ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV NODE_ENV production