31 lines
661 B
Docker
31 lines
661 B
Docker
# ===== STAGE 1 : build Angular =====
|
|
FROM node:20-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
# Dépendances
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
# Code source
|
|
COPY . .
|
|
|
|
# Build Angular en mode prod
|
|
RUN npm run build -- --configuration production
|
|
|
|
# ===== STAGE 2 : Nginx pour servir le build =====
|
|
FROM nginx:1.27-alpine
|
|
|
|
# On nettoie la racine Nginx
|
|
RUN rm -rf /usr/share/nginx/html/*
|
|
|
|
# ⚠ On copie TOUT dist/client dans l'image
|
|
# => ça crée /usr/share/nginx/html/browser/index.html
|
|
COPY --from=build /app/dist/client/ /usr/share/nginx/html/
|
|
|
|
# Conf Nginx spécifique à l'app
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"] |