Merge pull request #6 from cloud-club/dependabot/pip/app/backend/pill… #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: Build Dockerfile & Push to ACR & Deploy to AKS | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- "app/**" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
path: repo | |
- name: Move app directory | |
run: mv repo/app . && mv repo/manifest . && rm -rf repo | |
- name: Set up .env | |
run: echo "${{ secrets.ENV_SECRET }}" > app/.env | |
- name: Azure login | |
id: login | |
uses: azure/[email protected] | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Build and push Docker image to ACR | |
run: | | |
docker build -t ${{ secrets.REGISTRY }}.azurecr.io/${{ secrets.REPOSITORY }}/chatbot-app:${{ github.sha }} app | |
docker login ${{ secrets.REGISTRY }}.azurecr.io -u ${{ secrets.SERVICE_PRINCIPAL }} -p ${{ secrets.SERVICE_PRINCIPAL_PASSWORD }} | |
docker push ${{ secrets.REGISTRY }}.azurecr.io/${{ secrets.REPOSITORY }}/chatbot-app:${{ github.sha }} | |
- name: Set up kubelogin | |
uses: azure/use-kubelogin@v1 | |
with: | |
kubelogin-version: 'v0.0.24' | |
- name: Set AKS context | |
id: set-context | |
uses: azure/aks-set-context@v3 | |
with: | |
resource-group: '${{ secrets.RESOURCE_GROUP }}' | |
cluster-name: '${{ secrets.CLUSTER_NAME }}' | |
admin: 'false' | |
use-kubelogin: 'true' | |
- name: Setup kubectl | |
id: install-kubectl | |
uses: azure/setup-kubectl@v3 | |
- name: Deploy to AKS | |
id: deploy-aks | |
uses: Azure/k8s-deploy@v4 | |
with: | |
namespace: 'default' | |
manifests: | | |
manifest/app.yaml | |
images: '${{ secrets.REGISTRY }}.azurecr.io/${{ secrets.REPOSITORY }}/chatbot-app:${{ github.sha }}' | |
pull-images: false |