diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml index 8dca0bf..f761d68 100644 --- a/.gitea/workflows/docker.yml +++ b/.gitea/workflows/docker.yml @@ -12,14 +12,30 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + # 🔹 Build image - name: Build Docker image - run: docker build -t front-fiscad . + run: docker build -t front-fiscad:latest . + # 🔹 Stop ancien container - name: Stop old container run: | docker stop front-fiscad || true - docker rmi front-fiscad || true + docker rm front-fiscad || true + # 🔹 Supprimer ancienne image (optionnel mais propre) + - name: Remove old image + run: | + docker image prune -f + + # 🔹 Lancer nouveau container - name: Run new container run: | - docker run -d -p 8383:80 --name front-fiscad front-fiscad \ No newline at end of file + docker run -d \ + -p 8383:80 \ + --name front-fiscad \ + --restart=always \ + front-fiscad:latest + + # 🔹 Vérification + - name: Check container + run: docker ps | grep front-fiscad \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4a5720c..beacc20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # ============================== # 1️⃣ Build Angular (Node) # ============================== -FROM node:18-alpine AS build +FROM node:18-alpine AS compile WORKDIR /app @@ -24,16 +24,16 @@ RUN node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --co # ============================== # 2️⃣ Serveur Nginx # ============================== -FROM nginx:latest +FROM nginx:latest as build # 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=compile /app/dist/infocad-back-office/ /usr/share/nginx/html -COPY --from=build /app/nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=compile /app/nginx.conf /etc/nginx/conf.d/default.conf -COPY --from=build /app/.htaccess /usr/share/nginx/html +COPY --from=compile /app/.htaccess /usr/share/nginx/html RUN chmod -R 777 /usr/share/nginx/html