diff --git a/client/Dockerfile b/client/Dockerfile index a5735fb..cac0e97 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -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