Update client/Dockerfile

This commit is contained in:
2025-11-28 15:48:08 +00:00
parent 1cda6f4660
commit 6cc3423451

View File

@@ -1,4 +1,5 @@
FROM node:20-alpine # === Étape 1 : build Angular ===
FROM node:20-alpine AS build
WORKDIR /app WORKDIR /app
@@ -7,6 +8,21 @@ RUN npm ci
COPY . . 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"] # === É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;"]