Skip to content

Commit 20273cc

Browse files
authored
Create deploy.yml
1 parent def2f6a commit 20273cc

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

workflows/deploy.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: 🚀 Déploiement automatique vers AKS
2+
3+
on:
4+
push:
5+
branches:
6+
- principal
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: 📥 Cloner le dépôt
14+
uses: actions/checkout@v3
15+
16+
- name: 🔐 Connexion à Azure
17+
uses: azure/login@v1
18+
with:
19+
creds: ${{ secrets.AZURE_CREDENTIALS }}
20+
21+
- name: 🔓 Connexion à ACR
22+
run: az acr login --name acraksprive
23+
24+
- name: 🐳 Build et push de l'image Docker
25+
run: |
26+
docker build -t acraksprive.azurecr.io/bonjour-le-monde:latest .
27+
docker push acraksprive.azurecr.io/bonjour-le-monde:latest
28+
29+
- name: ☸️ Connexion à AKS
30+
uses: azure/aks-set-context@v3
31+
with:
32+
creds: ${{ secrets.AZURE_CREDENTIALS }}
33+
cluster-name: aksprive_test
34+
resource-group: RG_test_aksprive
35+
36+
- name: 🚀 Déploiement Kubernetes
37+
run: |
38+
kubectl create deployment bonjour-le-monde --image=acraksprive.azurecr.io/bonjour-le-monde:latest --dry-run=client -o yaml > deploy.yaml
39+
kubectl apply -f deploy.yaml
40+
kubectl expose deployment bonjour-le-monde --type=LoadBalancer --port=80 --target-port=3000 --name=bonjour-service --dry-run=client -o yaml > service.yaml
41+
kubectl apply -f service.yaml

0 commit comments

Comments
 (0)