# Build stage
FROM node:20-alpine AS build

WORKDIR /app

# Copier package.json et installer dépendances
COPY package*.json ./
RUN npm ci

# Copier le code source
COPY . .

# Build Angular production
RUN npm run build -- --configuration production

# Production stage
FROM nginx:alpine

# Copier la config nginx personnalisée
COPY nginx.conf /etc/nginx/nginx.conf

# Copier les fichiers buildés depuis le stage build
COPY --from=build /app/www /usr/share/nginx/html

# Exposer le port 80
EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
