28 lines
587 B
Docker
28 lines
587 B
Docker
# === Étape 1 : build Angular ===
|
|
FROM node:20-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
|
|
# Build en utilisant la config "production" (remplace environment.ts par environment.prod.ts)
|
|
RUN npm run build
|
|
|
|
# === É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;"] |