Update client/Dockerfile
This commit is contained in:
@@ -1,25 +1,32 @@
|
||||
# ---------- Stage 1 : build Angular ----------
|
||||
FROM node:20-alpine AS build
|
||||
# ======================
|
||||
# 1) Build Angular
|
||||
# ======================
|
||||
FROM node:20 AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Dépendances
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Sources
|
||||
COPY . .
|
||||
|
||||
# Build Angular en mode prod
|
||||
# Build prod Angular (utilise angular.json -> outputPath: dist/client)
|
||||
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
|
||||
|
||||
# Copie du build Angular
|
||||
COPY --from=build /app/dist/client /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user