Update client/Dockerfile

This commit is contained in:
2025-11-28 17:03:04 +00:00
parent 136532947f
commit bfa90c5b31

View File

@@ -1,25 +1,32 @@
# ---------- Stage 1 : build Angular ---------- # ======================
FROM node:20-alpine AS build # 1) Build Angular
# ======================
FROM node:20 AS build
WORKDIR /app WORKDIR /app
# Dépendances
COPY package*.json ./ COPY package*.json ./
RUN npm ci RUN npm ci
# Sources
COPY . . COPY . .
# Build Angular en mode prod # Build prod Angular (utilise angular.json -> outputPath: dist/client)
RUN npm run build RUN npm run build
# ---------- Stage 2 : Nginx pour servir le build ---------- # ======================
FROM nginx:alpine # 2) NGINX final
# ======================
FROM nginx:stable
# Notre conf Nginx custom # 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/
# Conf Nginx custom (SPA + proxy /ps)
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copie du build Angular
COPY --from=build /app/dist/client /usr/share/nginx/html
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]