diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..60436387b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +# --- Étape 1: Construire l'application --- +FROM node:20-alpine AS build +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build + +# --- Étape 2: Servir l'application avec NGINX --- +FROM nginx:alpine AS final +# Supprimer le contenu par défaut de NGINX +RUN rm -rf /usr/share/nginx/html/* +# Copier les fichiers de construction (ce chemin est standard pour le RealWorld) +COPY --from=build /app/dist/angular-realworld-example-app /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..108b41b89 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.8' + +services: + # Environnement de staging + app-staging: + image: angular-app:staging + container_name: app-staging + ports: + - "8080:80" + restart: unless-stopped + networks: + - app-network + + # Environnement de production + app-production: + image: angular-app:production + container_name: app-production + ports: + - "80:80" + restart: unless-stopped + networks: + - app-network + +networks: + app-network: + driver: bridge