This commit is contained in:
Alexis Bruneteau 2025-05-31 03:28:06 +02:00
parent c03360713f
commit 9d25fbc935

View File

@ -26,16 +26,16 @@ jobs:
- name: Build Docker image
run: |
docker build -t ${{ secrets.REGISTRY_URL }}/angular-app:${{ github.sha }} .
docker tag ${{ secrets.REGISTRY_URL }}/angular-app:${{ github.sha }} ${{ secrets.REGISTRY_URL }}/angular-app:latest
docker build -t ${{ secrets.REGISTRY_URL }}/hosting-frontend:${{ github.sha }} .
docker tag ${{ secrets.REGISTRY_URL }}/hosting-frontend:${{ github.sha }} ${{ secrets.REGISTRY_URL }}/hosting-frontend:latest
- name: Login to Container Registry
run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ secrets.REGISTRY_URL }} -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ secrets.REGISTRY_URL }} -u "${{ secrets.REGISTRY_USER }}" --password-stdin
- name: Push Docker image
run: |
docker push ${{ secrets.REGISTRY_URL }}/angular-app:${{ github.sha }}
docker push ${{ secrets.REGISTRY_URL }}/angular-app:latest
docker push ${{ secrets.REGISTRY_URL }}/hosting-frontend:${{ github.sha }}
docker push ${{ secrets.REGISTRY_URL }}/hosting-frontend:latest
- name: Setup kubectl
uses: azure/setup-kubectl@v3
@ -50,20 +50,20 @@ jobs:
- name: Create ConfigMap for app files
run: |
kubectl create configmap angular-app-files \
--from-file=dist/your-angular-app/ \
--namespace=angular-app \
kubectl create configmap hosting-frontend-files \
--from-file=dist/hosting-frontend/browser \
--namespace=hosting-frontend \
--dry-run=client -o yaml | kubectl apply -f -
- name: Create ConfigMap for nginx config
run: |
kubectl create configmap nginx-config \
--from-file=nginx.conf \
--namespace=angular-app \
--namespace=hosting-frontend \
--dry-run=client -o yaml | kubectl apply -f -
- name: Deploy to k3s
run: |
kubectl apply -f k8s/
kubectl set image deployment/angular-app angular-app=${{ secrets.REGISTRY_URL }}/angular-app:${{ github.sha }} -n angular-app
kubectl rollout status deployment/angular-app -n angular-app
kubectl set image deployment/hosting-frontend hosting-frontend=${{ secrets.REGISTRY_URL }}/hosting-frontend:${{ github.sha }} -n hosting-frontend
kubectl rollout status deployment/hosting-frontend -n hosting-frontend