minor fixes #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Kubernetes | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push backend image | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./api | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/qr-code-backend:latest | |
- name: Build and push frontend image | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./front-end-nextjs | |
push: true | |
target: production | |
tags: ${{ secrets.DOCKER_USERNAME }}/qr-code-frontend:latest | |
- name: Set up kubectl | |
uses: azure/setup-kubectl@v1 | |
with: | |
version: 'latest' | |
- name: Set up Azure CLI | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Get AKS credentials | |
run: | | |
az aks get-credentials --resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} --name ${{ secrets.AKS_CLUSTER_NAME }} | |
- name: Set up kubeconfig | |
run: | | |
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config | |
env: | |
KUBECONFIG: $HOME/.kube/config | |
- name: Deploy to Kubernetes | |
run: | | |
kubectl apply -f k8s/secrets.yml | |
kubectl apply -f k8s/prometheus-deployment.yml | |
kubectl apply -f k8s/prometheus-service.yml | |
kubectl apply -f k8s/grafana-deployment.yml | |
kubectl apply -f k8s/grafana-service.yml | |
kubectl apply -f k8s/loki-deployment.yml | |
kubectl apply -f k8s/loki-service.yml | |
kubectl apply -f k8s/backend-deployment.yml | |
kubectl apply -f k8s/backend-service.yml | |
kubectl apply -f k8s/frontend-deployment.yml | |
kubectl apply -f k8s/frontend-service.yml | |
kubectl apply -f k8s/ingress.yml | |