31 lines
690 B
Docker
31 lines
690 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 le build Angular dans un sous-dossier /gameovergne
|
|
# => important pour que /gameovergne/ fonctionne
|
|
COPY --from=build /app/dist/client /usr/share/nginx/html/gameovergne
|
|
|
|
# On remplace la conf par notre conf appli
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"] |