From 6cc3423451bc53313b4691dcca2c9fabaf40f4b5 Mon Sep 17 00:00:00 2001 From: Vincent Guillet Date: Fri, 28 Nov 2025 15:48:08 +0000 Subject: [PATCH] Update client/Dockerfile --- client/Dockerfile | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/client/Dockerfile b/client/Dockerfile index 760e95d..463f7b9 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,4 +1,5 @@ -FROM node:20-alpine +# === Étape 1 : build Angular === +FROM node:20-alpine AS build WORKDIR /app @@ -7,6 +8,21 @@ RUN npm ci COPY . . -EXPOSE 4200 +# Build en utilisant la config "production" (remplace environment.ts par environment.prod.ts) +RUN npm run build -CMD ["npx", "ng", "serve", "--host", "0.0.0.0", "--port", "4200", "--configuration", "production", "--proxy-config", "proxy.conf.json"] \ No newline at end of file +# === Étape 2 : Nginx pour servir le build === +FROM nginx:alpine + +# On nettoie la racine par défaut +RUN rm -rf /usr/share/nginx/html/* + +# On copie le build Angular +COPY --from=build /app/dist/client/ /usr/share/nginx/html/ + +# On copie la conf Nginx custom +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file