34 lines
644 B
Docker
34 lines
644 B
Docker
# --- Étape 1 : Build du frontend ---
|
|
FROM node:22-alpine AS builder
|
|
|
|
# Création du dossier
|
|
WORKDIR /app
|
|
|
|
# Installation des dépendances
|
|
COPY package.json package-lock.json ./
|
|
|
|
RUN npm install --legacy-peer-deps
|
|
|
|
# Copie du code source
|
|
COPY . .
|
|
|
|
# Build du projet
|
|
RUN npm run build
|
|
|
|
# --- Étape 2 : Serveur web (Nginx) ---
|
|
FROM nginx:alpine
|
|
|
|
# Suppression de la config par défaut
|
|
RUN rm -rf /usr/share/nginx/html/*
|
|
|
|
# Copie du build
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Copie (optionnelle) d'une config Nginx personnalisée
|
|
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|
|
|