-
Notifications
You must be signed in to change notification settings - Fork 3
28 lines (25 loc) · 993 Bytes
/
cicd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
name: Deploy Node Application
on:
push:
branches:
- erp-dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build Docker Image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/institute-management-backend .
- name: Publish Docker Image
run: docker push ${{ secrets.DOCKER_USERNAME }}/institute-management-backend:latest
publish:
needs: build
runs-on: self-hosted
steps:
- name: Pull Docker Image
run: docker pull ${{ secrets.DOCKER_USERNAME }}/institute-management-backend:latest
- name: Run Docker Container
run: docker run -d -p 5000:5000 --name institute-management-backend -e MONGO_URI=${{ secrets.MONGO_URI }} ${{ secrets.DOCKER_USERNAME }}/institute-management-backend:latest