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