To Master #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@master | |
with: | |
node-version: 20.x | |
- name: Install dependencies | |
run: npm install | |
- name: Stop and Remove existing container | |
run: | | |
docker stop SolarBackend || true | |
docker rm SolarBackend || true | |
- name: Build Docker Image | |
run: docker build -t aerscs/solar-backend-docker:latest \ | |
--build-arg APP_PORT=${{ secrets.APP_PORT }} \ | |
--build-arg BOT=${{ secrets.BOT }} \ | |
--build-arg ADMIN=${{ secrets.ADMIN }} \ | |
--build-arg DB_CONNECTION_STRING=${{ secrets.DB_CONNECTION_STRING }} \ | |
. | |
- name: Run Docker container | |
run: docker run -d --restart unless-stopped -p 3000:${{ secrets.APP_PORT }} --name SolarBackend aerscs/solar-backend-docker:latest |