Skip to content

Build and deploy MERN stack #4

Build and deploy MERN stack

Build and deploy MERN stack #4

Workflow file for this run

name: Build and deploy MERN stack
on:
workflow_dispatch:
jobs:
build:
runs-on: machine1
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Login to DockerHub
uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
run: |
docker build -t hellopradum/backend-wanderlust backend/.
docker build -t hellopradum/frontend-wanderlust frontend/.
docker push hellopradum/backend-wanderlust:latest
docker push hellopradum/frontend-wanderlust:latest
- name: Create and claim persistent volume
run: |
sudo su
kubectl apply -f kubernetes/persistentVolume.yaml
kubectl apply -f kubernetes/persistentVolumeClaim.yaml
- name: Deploy MongoDB
run: |
kubectl apply -f kubernetes/mongodb.yaml
- name: Deploy Redis
run: |
kubectl apply -f kubernetes/redis.yaml
- name: Deploy Backend
run: |
kubectl apply -f kubernetes/backend.yaml
- name: Deploy Frontend
run: |
kubectl apply -f kubernetes/frontend.yaml