-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·57 lines (46 loc) · 1.15 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
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
#! /bin/bash
buildFrontend() {
echo 'building frontend...'
for org in shipper transporter warehouse consignee; do
echo "building [$org] frontend..."
pushd frontend/$org
rm package-lock.json
rm -rf node_modules/
npm install
ng build --prod
popd
echo "done..."
done
echo 'copy frontend resources to nginx...'
for org in shipper transporter warehouse consignee; do
echo "copy [$org] frontend..."
cp -r frontend/$org/dist/$org /usr/share/nginx/html/
echo "done..."
done
echo
}
buildBackend() {
echo 'building backend...'
for org in shipper transporter warehouse consignee; do
echo "building [$org] backend..."
pushd backend/$org
rm package-lock.json
rm -rf node_modules/
npm install
npm run build
popd
echo "done..."
done
}
CMD=$1
echo "./build.sh $CMD"
if [ "$CMD" == "all" ]; then
buildFrontend
buildBackend
elif [ "$CMD" == "backend" ]; then
buildBackend
elif [ "$CMD" == "frontend" ]; then
buildFrontend
else
echo "args: all, backend or frontend"
fi