forked from vitrivr/vitrivr-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·67 lines (54 loc) · 1.68 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
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Path to deployment folder (adjust)
deploy=$1
if [ -z ${1+x} ]; then
echo "Error: Please specify a deployment directory."; >&2
exit 1
fi
if [ ! -d $deploy ]; then
echo "Error: Specified deployment directory '$deploy' does not exist." >&2
exit 1
fi
# Begin...
echo "Deploying Vitrivr NG to $deploy. Did you update your project (GitHub)?"
# Building project
echo "Step 1: Updating dependencies..."
npm install >> deploy.log 2>&1
if [ $? -ne 0 ]; then
echo "Step 1 failed: Please check deploy.log" >&2
exit 1
fi
#
echo "Step 2: Building project..."
ng build --prod >> deploy.log 2>&1
if [ $? -ne 0 ]; then
echo "Step 2 failed: Please check deploy.log" >&2
exit 1
fi
if [ -f $deploy/config.json ]; then
rm dist/config.json
fi
# Remove old files
echo "Step 3a: Clean-up old deployment..."
rm $deploy/3rdpartylicenses.txt >> deploy.log 2>&1
rm $deploy/MaterialIcons-Regular* >> deploy.log 2>&1
rm $deploy/favicon.ico >> deploy.log 2>&1
rm $deploy/index.html >> deploy.log 2>&1
rm $deploy/main.*.js >> deploy.log 2>&1
rm $deploy/polyfills.*.js >> deploy.log 2>&1
rm $deploy/runtime.*.js >> deploy.log 2>&1
rm $deploy/styles.*.css >> deploy.log 2>&1
rm $deploy/videogular.*.eot >> deploy.log 2>&1
rm $deploy/videogular.*.svg >> deploy.log 2>&1
rm -rf $deploy/assets >> deploy.log 2>&1
# Copy files
echo "Step 3b: Deploy..."
mv dist/* $deploy >> deploy.log 2>&1
if [ $? -ne 0 ]; then
echo "Step 3 failed: Please check deploy.log" >&2
exit 1
fi
# Optional: Adjust permissions
chown root:root $deploy >> deploy.log 2>&1
chown -R root:root $deploy/assets >> deploy.log 2>&1
echo "Successfully deployed Vitrivr NG to $deploy. Check deploy.log for more information."