-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdockerfile
More file actions
39 lines (27 loc) · 809 Bytes
/
dockerfile
File metadata and controls
39 lines (27 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# === Stage 1: Build ===
FROM node:24-bullseye AS builder
# Crée le dossier de travail
WORKDIR /app
# Copie package.json + package-lock.json pour installer les deps
COPY package*.json ./
# Installe les dépendances
RUN npm ci --legacy-peer-deps
# Copie tout le projet
COPY . .
# Build du projet Next.js
RUN npm run build
# === Stage 2: Run ===
FROM node:24-bullseye AS runner
WORKDIR /app
# Copie seulement les fichiers nécessaires depuis le build
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
# COPY --from=builder /app/next.config.js ./
# Installe uniquement les deps de prod
ENV NODE_ENV=production
RUN npm ci --omit=dev
# Expose le port
EXPOSE 3000
# Commande pour démarrer le serveur Next.js
CMD ["npm", "start"]