fix: Change Alpine to Debian-based image for Prisma compatibility

Alpine Linux doesn't have libssl1.1 which Prisma needs.
Using node:20-slim instead with proper OpenSSL libraries.
This commit is contained in:
2026-03-23 23:13:45 -03:00
parent 3a523aafde
commit c8674dd56f

View File

@@ -1,7 +1,10 @@
# Stage 1: Dependencies
FROM node:20-alpine AS deps
FROM node:20-slim AS deps
RUN apk add --no-cache libc6-compat
RUN apt-get update && apt-get install -y --no-install-recommends \
libc6-compat \
openssl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
@@ -10,10 +13,15 @@ COPY package.json package-lock.json* ./
RUN npm ci
# Stage 2: Build
FROM node:20-alpine AS builder
FROM node:20-slim AS builder
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
libc6-compat \
openssl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=deps /app/node_modules ./node_modules
COPY . .
@@ -22,14 +30,17 @@ RUN npx prisma generate
RUN npm run build
# Stage 3: Production
FROM node:20-alpine AS runner
FROM node:20-slim AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
RUN apt-get update && apt-get install -y --no-install-recommends \
openssl \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --system --gid 1001 nodejs \
&& useradd --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
@@ -45,6 +56,6 @@ EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
ENV DATABASE_URL="file:./dev.db"
ENV DATABASE_URL="file:./data/dev.db"
CMD ["node", "server.js"]