Skip to content

Added Continous Deployment to Kubernetes. #37

Added Continous Deployment to Kubernetes.

Added Continous Deployment to Kubernetes. #37

Workflow file for this run

name: Build and Push Docker Image to Docker Hub & GHCR
on:
push:
branches:
- master
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: gautampatil1
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image
run: docker build -t gautampatil1/rezume:latest .
- name: Push Docker image to Docker Hub
run: docker push gautampatil1/rezume:latest
- name: Push Docker image to ghcr.io
run: |
docker login --username gautampatil1 --password ${{ secrets.GH_PAT }} ghcr.io
docker tag gautampatil1/rezume:latest ghcr.io/gautampatil1/rezume:latest
docker push ghcr.io/gautampatil1/rezume:latest
- name: SSH into instance and restart Minikube
run: |
mkdir -p ~/.ssh # Create .ssh directory if it doesn't exist
touch ~/.ssh/known_hosts # Create known_hosts file if it doesn't exist
ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/id_rsa
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa ${{ secrets.USERNAME }}@${{ secrets.HOST }} "minikube start --driver=docker"
env:
SSH_AUTH_SOCK: /dev/null