41 lines
938 B
YAML
41 lines
938 B
YAML
name: Angular Docker CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: [self-hosted, prod]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
# 🔹 Build image
|
|
- name: Build Docker image
|
|
run: docker build -t front-fiscad:latest .
|
|
|
|
# 🔹 Stop ancien container
|
|
- name: Stop old container
|
|
run: |
|
|
docker stop 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 \
|
|
--restart=always \
|
|
front-fiscad:latest
|
|
|
|
# 🔹 Vérification
|
|
- name: Check container
|
|
run: docker ps | grep front-fiscad |