Update main.yml #5
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 React App | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ['self-hosted', 'Linux', 'X64', 'react' ] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
node-version: '20.11.1' | |
# Display npm version | |
- name: Display npm version | |
run: npm --version | |
- name: stop old container | |
run: sudo docker container stop react-container || true | |
# install dependencies | |
- name: Install dependencies | |
run: npm install | |
# build the react app | |
- name: Build | |
run: npm run build | |
- name: Delete old container | |
run: sudo docker container rm react-container|| true | |
- name: Delete old image | |
run: sudo docker image rm react || true | |
- name: Build the Docker image | |
run: sudo docker build -t react . | |
- name: Run docker image | |
run: sudo docker run -d --env-file /home/ubuntu/env.properties -p 3000:3000 --name react-container quizmate sleep infinity| echo "success" |