Skip to content

Update deploy.yml

Update deploy.yml #15

Workflow file for this run

name: CI/CD with Kubernetes
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Kubernetes config
run: echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to DockerHub
run: docker login -u harisathwik -p ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
run: |
docker buildx build --push --tag harisathwik/streamlit_app:${{ github.sha }} .
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install ngrok
run: |
curl -LO https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
sudo mv ngrok /usr/local/bin
chmod +x /usr/local/bin/ngrok
- name: Expose Kubernetes service with ngrok
run: ngrok authtoken ${{ secrets.NGROK_AUTH_TOKEN }} && ngrok http 80 &
- name: Apply Kubernetes deployment
run: |
kubectl apply -f kubernetes/deployment.yaml
kubectl apply -f kubernetes/service.yaml