Skip to content

loading spinenr

loading spinenr #36

Workflow file for this run

name: CICD
on:
push:
branches:
- main
jobs:
build-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Login to Docker Hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker Image
run: docker build -t jekku123/mern-test-react --build-arg VITE_NODE_ENV='production' --build-arg VITE_SERVER_URL='${{ secrets.VITE_SERVER_URL }}' ./client
- name: Publish image to docker hub
run: docker push jekku123/mern-test-react:latest
deploy-frontend:
needs: build-frontend
runs-on: self-hosted
steps:
- name: Pull image from docker hub
run: docker pull jekku123/mern-test-react:latest
- name: Delete Old Container
run: docker rm -f mern-test-react-container
- name: Run docker container
run: docker run -d -p 5173:80 --name mern-test-react-container jekku123/mern-test-react
build-backend:
needs: deploy-frontend
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Login to docker hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker Image
run: docker build -t jekku123/mern-test ./server
- name: Publish Image to docker hub
run: docker push jekku123/mern-test:latest
deploy-backend:
needs: build-backend
runs-on: self-hosted
steps:
- name: Pull image from docker hub
run: docker pull jekku123/mern-test:latest
- name: Delete old container
run: docker rm -f mern-test-container
- name: Run Docker Container
run: docker run -d -p 4000:4000 --name mern-test-container -e MONGO_URI='${{ secrets.MONGO_URI }}' -e ACCESS_TOKEN_SECRET='${{ secrets.ACCESS_TOKEN_SECRET }}' -e REFRESH_TOKEN_SECRET='${{ secrets.REFRESH_TOKEN_SECRET }}' jekku123/mern-test