Skip to content

Build and deploy MERN stack #20

Build and deploy MERN stack

Build and deploy MERN stack #20

Workflow file for this run

name: Build and deploy MERN stack
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.AWS_SECRET_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
- 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: Update kubeconfig
run: aws eks update-kubeconfig --name wanderlust-ekscluster1
- name: Create and claim persistent volume
run: |
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