forked from Azure-Samples/nodejs-docs-hello-world
-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (33 loc) · 1.24 KB
/
deploy.yml
File metadata and controls
41 lines (33 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: 🚀 Déploiement automatique vers AKS
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 📥 Cloner le dépôt
uses: actions/checkout@v3
- name: 🔐 Connexion à Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 🔓 Connexion à ACR
run: az acr login --name acraksprive
- name: 🐳 Build et push de l'image Docker
run: |
docker build -t acraksprive.azurecr.io/bonjour-le-monde:latest .
docker push acraksprive.azurecr.io/bonjour-le-monde:latest
- name: ☸️ Connexion à AKS
uses: azure/aks-set-context@v3
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
cluster-name: aksprive_test
resource-group: RG_test_aksprive
- name: 🚀 Déploiement Kubernetes
run: |
kubectl create deployment bonjour-le-monde --image=acraksprive.azurecr.io/bonjour-le-monde:latest --dry-run=client -o yaml > deploy.yaml
kubectl apply -f deploy.yaml
kubectl expose deployment bonjour-le-monde --type=LoadBalancer --port=80 --target-port=3000 --name=bonjour-service --dry-run=client -o yaml > service.yaml
kubectl apply -f service.yaml