fix runner, db & prisma

This commit is contained in:
Puechberty Arthur
2026-06-12 02:03:16 +02:00
parent 1fdc145167
commit 453617e793
2 changed files with 30 additions and 6 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
NEXT_PUBLIC_BASE_URL=https://reducelink.arthurp.fr
# Base de données SQLite
DATABASE_URL="file:./dev.db"
DATABASE_URL="file:/app/data/db.db"
# Port exposé côté machine
APP_PORT=3000
+29 -5
View File
@@ -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