-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.sh
executable file
·55 lines (44 loc) · 1.07 KB
/
deploy.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
if [ "$1" == "clean" ]
then
rm -rf deploy/package.json
rm -rf dist/
elif [ "$1" == "run" ]
then
sudo docker container run --name web -d -p 1500:1500 web
elif [ "$1" == "deploy" ]
then
mkdir -p dist/dist/
npm run-script build
cp package.json deploy/package.json
cp deploy/* dist/
cd dist/dist/
ln -s ../.next .next
cd ..
npm install --production
elif [ "$1" == "stop" ]
then
sudo docker container kill web
sudo docker container rm web
elif [ "$1" == "install" ]
then
#Assume Debian 10, cloned repository
#install node14
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
#install yarn
# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# sudo apt update && sudo apt install yarn
sudo npm install
else
mkdir -p dist/dist/
npm run-script build
cp package.json deploy/package.json
cp deploy/* dist/
cd dist/dist/
ln -s ../.next .next
cd ..
npm install
sudo docker build -t web .
fi