mirror of
https://github.com/arthur-pbty/reducelink.git
synced 2026-08-01 20:29:47 +02:00
fix runner, db & prisma
This commit is contained in:
+29
-5
@@ -1,30 +1,54 @@
|
||||
# ===== BUILD =====
|
||||
# =========================
|
||||
# BUILD STAGE
|
||||
# =========================
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# dépendances
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
# code source
|
||||
COPY . .
|
||||
|
||||
# Prisma generate (OBLIGATOIRE avant build Next)
|
||||
RUN npx prisma generate
|
||||
|
||||
# build Next.js (standalone)
|
||||
RUN npm run build
|
||||
|
||||
|
||||
# ===== RUN =====
|
||||
# =========================
|
||||
# RUN STAGE
|
||||
# =========================
|
||||
FROM node:20-alpine AS runner
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
|
||||
# Standalone output
|
||||
COPY --from=builder /app/public ./public
|
||||
# Installer uniquement les deps prod (nécessaire pour Prisma runtime)
|
||||
COPY package*.json ./
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
# Next standalone output
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Prisma (schema + migrations + seed si existant)
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
|
||||
RUN prism generate
|
||||
# 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
|
||||
|
||||
# SQLite data folder (IMPORTANT)
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
VOLUME ["/app/data"]
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user