Update client/Dockerfile
This commit is contained in:
@@ -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"]
|
||||
# === É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;"]
|
||||
Reference in New Issue
Block a user