42 lines
990 B
Docker
42 lines
990 B
Docker
# ==============================
|
||
# 1️⃣ Build Angular (Node)
|
||
# ==============================
|
||
FROM node:18-alpine AS build
|
||
|
||
WORKDIR /app
|
||
|
||
# Copier uniquement les fichiers nécessaires pour optimiser le cache
|
||
COPY package*.json ./
|
||
|
||
# Installer les dépendances
|
||
# RUN npm install
|
||
RUN npm ci --legacy-peer-deps
|
||
|
||
# Copier le reste du projet
|
||
COPY . .
|
||
|
||
# Build Angular (production)
|
||
# RUN npm run build -- --configuration production
|
||
RUN node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --configuration production
|
||
|
||
|
||
|
||
# ==============================
|
||
# 2️⃣ Serveur Nginx
|
||
# ==============================
|
||
FROM nginx:latest
|
||
|
||
# Supprimer config par défaut
|
||
RUN rm -rf /usr/share/nginx/html/*
|
||
|
||
COPY --from=build /app/dist/infocad-back-office/ /usr/share/nginx/html
|
||
|
||
COPY --from=build /app/nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
||
COPY --from=build /app/.htaccess /usr/share/nginx/html
|
||
|
||
RUN chmod -R 777 /usr/share/nginx/html
|
||
|
||
EXPOSE 80
|
||
|
||
CMD ["nginx", "-g", "daemon off;"] |