Skip to content

feat: integrate server app into azure using github actions and kubernetes #3

feat: integrate server app into azure using github actions and kubernetes

feat: integrate server app into azure using github actions and kubernetes #3

name: Deploy to AKS
on:
push:
branches:
- main
pull_request: #just for tests
types: [opened, synchronize, reopened, ready_for_review]
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 GitHub Packages
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} # Assuming GITHUB_TOKEN has the required permissions
- name: Build and push Docker image
run: |
docker build -f apps/server/Dockerfile -t docker.pkg.github.com/${{ github.repository }}/nextjs-image:latest .
docker push docker.pkg.github.com/${{ github.repository }}/nextjs-image:latest
- name: Set up kubectl
uses: azure/setup-kubectl@v1
# with:
# version: "1.22.2"
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set up AKS context
run: |
az aks get-credentials --resource-group YOUR_RESOURCE_GROUP_NAME --name YOUR_AKS_CLUSTER_NAME
- name: Deploy to AKS
run: |
kubectl apply -f kubernetes/mongodb-deployment.yaml
kubectl apply -f kubernetes/nextjs-deployment.yaml