-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (30 loc) · 1016 Bytes
/
main.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
29
30
31
32
33
34
35
36
37
38
39
40
41
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"