-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
22 lines (19 loc) · 1.09 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/bash
# jenkins runs this in an interactive shell, which is different from when we normally ssh in
# because of this, jenkins does not properly source the .bashrc file, which instantiates nvm
. ~/.bashrc
# package and release the server first (koa)
cd "$WORKSPACE/server"
npm install # download node libraries
rm -rf test .eslintrc .gitignore nodemon.json # delete development specific files
rm -rf ~/api/* # delete existing server code
cp -r $WORKSPACE/server/* ~/api # copy the server code
cp -f ~/config_dev.js ~/api/config_dev.js # copy config used for the deployment
cd ~/api # switch folder to the server directory
pm2 reload server # reload and restart the server - to start a new app, we do pm2 start server.js -i 1
# package and release the client side (react)
cd "$WORKSPACE/client"
npm install # download node libraries
npm run build # build react app, package it and place it under build folder
rm -rf /var/www/turing.cagdasucar.com/html/* # delete existing client app code
cp -r $WORKSPACE/client/build/* /var/www/turing.cagdasucar.com/html/ # copy packaged client app code to the nginx folder