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:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
NEXT_PUBLIC_BASE_URL=https://reducelink.arthurp.fr
|
NEXT_PUBLIC_BASE_URL=https://reducelink.arthurp.fr
|
||||||
|
|
||||||
# Base de données SQLite
|
# Base de données SQLite
|
||||||
DATABASE_URL="file:./dev.db"
|
DATABASE_URL="file:/app/data/db.db"
|
||||||
|
|
||||||
# Port exposé côté machine
|
# Port exposé côté machine
|
||||||
APP_PORT=3000
|
APP_PORT=3000
|
||||||
|
|||||||
+29
-5
@@ -1,30 +1,54 @@
|
|||||||
# ===== BUILD =====
|
# =========================
|
||||||
|
# BUILD STAGE
|
||||||
|
# =========================
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine 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)
|
||||||
|
RUN npx prisma generate
|
||||||
|
|
||||||
|
# build Next.js (standalone)
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
# ===== RUN =====
|
# =========================
|
||||||
|
# RUN STAGE
|
||||||
|
# =========================
|
||||||
FROM node:20-alpine AS runner
|
FROM node:20-alpine AS runner
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
ENV PORT=3000
|
||||||
|
|
||||||
# Standalone output
|
# Installer uniquement les deps prod (nécessaire pour Prisma runtime)
|
||||||
COPY --from=builder /app/public ./public
|
COPY package*.json ./
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
|
# Next standalone output
|
||||||
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
|
||||||
|
|
||||||
|
# Prisma (schema + migrations + seed si existant)
|
||||||
COPY --from=builder /app/prisma ./prisma
|
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
|
EXPOSE 3000
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user