Update client/Dockerfile

This commit is contained in:
2025-11-28 17:13:45 +00:00
parent 82de928f3e
commit 03661021cc

View File

@@ -1,7 +1,5 @@
# ======================
# 1) Build Angular
# ======================
FROM node:20 AS build
# ===== STAGE 1 : build Angular =====
FROM node:20-alpine AS build
WORKDIR /app
@@ -9,22 +7,23 @@ WORKDIR /app
COPY package*.json ./
RUN npm ci
# Sources
# Code source
COPY . .
# Build prod Angular (utilise angular.json -> outputPath: dist/client)
RUN npm run build
# Build Angular en mode prod
RUN npm run build -- --configuration production
# ======================
# 2) NGINX final
# ======================
FROM nginx:stable
# ===== STAGE 2 : Nginx pour servir le build =====
FROM nginx:1.27-alpine
# On remplace complètement le contenu par le build Angular
# ⚠️ IMPORTANT : Angular 18 + builder "application" -> dist/client (pas /browser)
COPY --from=build /app/dist/client/ /usr/share/nginx/html/
# On nettoie la racine Nginx
RUN rm -rf /usr/share/nginx/html/*
# Conf Nginx custom (SPA + proxy /ps)
# On copie le build Angular dans un sous-dossier /gameovergne
# => important pour que /gameovergne/ fonctionne
COPY --from=build /app/dist/client /usr/share/nginx/html/gameovergne
# On remplace la conf par notre conf appli
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80