feat: integrate server app into azure using github actions and kubernetes #8
Workflow file for this run
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 Server to Azure | |
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: DEBUG | |
shell: bash | |
run: | | |
echo "!!! DEBUG !!!" | |
az aks list --query "[].{name:name, resourceGroup:resourceGroup}" -o table | |
echo "!!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!" | |
- name: Set up AKS context | |
run: | | |
az aks get-credentials --resource-group RG-Ethereal-Pulse --name CL-Ethereal-Pulse | |
- name: Deploy to AKS | |
run: | | |
kubectl apply -f kubernetes/mongodb-deployment.yaml | |
kubectl apply -f kubernetes/nextjs-deployment.yaml |