Skip to content

PR build

PR build #80

name: Docker Build & Kubernetes Run
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker Login
uses: docker/[email protected]
with:
registry: ${{ secrets.ACR_URL }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
logout: true
- name: Kubernetes Set Context
uses: Azure/[email protected]
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- name: Docker build & push, Kubernetes apply
run: |
docker build -t ${{ secrets.ACR_URL }}/levelupdevops:${{ github.sha }} .
docker push ${{ secrets.ACR_URL }}/levelupdevops:${{ github.sha }}
sed -i'' -e 's/ACR_URL/${{ secrets.ACR_URL }}/g' -e 's/AKS_URL/${{ secrets.AKS_URL }}/g' -e 's/IMAGE_LABEL/${{ github.sha }}/g' k8s.yaml
kubectl apply -f k8s.yaml