Skip to content

fix/pipeline_k8s

fix/pipeline_k8s #4

Workflow file for this run

name: Build and Deploy to K8s
on:
push:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: fullzer4
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Backend Image
run: docker build -t docker.io/fullzer4/backend_ai_realtime_pong:latest ./backend
- name: Build Frontend Image
run: docker build -t docker.io/fullzer4/frontend_ai_realtime_pong:latest ./frontend
- name: Push Backend Image
run: docker push docker.io/fullzer4/backend_ai_realtime_pong:latest
- name: Push Frontend Image
run: docker push docker.io/fullzer4/frontend_ai_realtime_pong:latest
- name: Deploy to K8s
run: |
kubectl set image deployment/backend-deployment backend=docker.io/fullzer4/backend_ai_realtime_pong:latest -n ai_realtime_pong_prod
kubectl set image deployment/frontend-deployment frontend=docker.io/fullzer4/frontend_ai_realtime_pong:latest -n ai_realtime_pong_prod
kubectl apply -f k8s/
env:
KUBECONFIG: ${{ secrets.KUBECONFIG }}