mirror of
https://github.com/arthur-pbty/reducelink.git
synced 2026-08-01 20:29:47 +02:00
fix dockerfile for prisma
This commit is contained in:
+13
-13
@@ -1,53 +1,53 @@
|
|||||||
# =========================
|
# =========================
|
||||||
# BUILD STAGE
|
# BUILD STAGE
|
||||||
# =========================
|
# =========================
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-bullseye AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# dépendances
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
# code source
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Prisma generate (OBLIGATOIRE avant build Next)
|
# Prisma generate
|
||||||
RUN npx prisma generate
|
RUN npx prisma generate
|
||||||
|
|
||||||
# build Next.js (standalone)
|
# Build Next.js
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
# =========================
|
# =========================
|
||||||
# RUN STAGE
|
# RUN STAGE
|
||||||
# =========================
|
# =========================
|
||||||
FROM node:20-alpine AS runner
|
FROM node:20-bullseye AS runner
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
|
|
||||||
# Installer uniquement les deps prod (nécessaire pour Prisma runtime)
|
# OpenSSL + Prisma runtime dependencies (IMPORTANT)
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
openssl \
|
||||||
|
ca-certificates \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci --omit=dev
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
# Next standalone output
|
# Next standalone
|
||||||
COPY --from=builder /app/.next/standalone ./
|
COPY --from=builder /app/.next/standalone ./
|
||||||
COPY --from=builder /app/.next/static ./.next/static
|
COPY --from=builder /app/.next/static ./.next/static
|
||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder /app/public ./public
|
||||||
|
|
||||||
# Prisma (schema + migrations + seed si existant)
|
# Prisma
|
||||||
COPY --from=builder /app/prisma ./prisma
|
COPY --from=builder /app/prisma ./prisma
|
||||||
|
|
||||||
# Prisma client généré
|
|
||||||
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
||||||
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
||||||
|
|
||||||
# SQLite data folder (IMPORTANT)
|
# SQLite folder
|
||||||
RUN mkdir -p /app/data
|
RUN mkdir -p /app/data
|
||||||
|
|
||||||
VOLUME ["/app/data"]
|
VOLUME ["/app/data"]
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|||||||
Reference in New Issue
Block a user