-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.sh
55 lines (42 loc) · 1.45 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
#!/bin/bash
current_dir=$(pwd)
echo $current_dir
rm -rf ~/firewalld-web
mkdir -p ~/firewalld-web
cd $current_dir/web
for item in $(ls -a); do
if [ "$item" == "node_modules" ]; then
echo 'skip node_modules'
elif [ "$item" == "." ]; then
echo 'skip .'
elif [ "$item" == ".." ]; then
echo 'skip ..'
else
cp -rf "$item" ~/firewalld-web/
echo "$item"
fi
done
cd ~/firewalld-web
pnpm install
pnpm run build
echo 'web build success'
cd $current_dir
cd $current_dir/server
go mod tidy
echo 'server start build'
CGO_ENABLED=0 go build -o server
echo 'server build success'
cd $current_dir
rm -rf build
mkdir -p build/web-firewalld
cp $current_dir/script/* $current_dir/build/
cp -r $current_dir/server/manifest $current_dir/build/web-firewalld/
cp -r $current_dir/server/resource $current_dir/build/web-firewalld/
cp -r $current_dir/server/server $current_dir/build/web-firewalld/
rm -rf $current_dir/build/web-firewalld/resource/public/html
cp -r ~/firewalld-web/dist $current_dir/build/web-firewalld/resource/public/html
rm -rf $current_dir/build/web-firewalld/resource/*.sqlite3
mv $current_dir/build/web-firewalld/resource/db.sqlite3.bak $current_dir/build/web-firewalld/resource/db.sqlite3
rm -rf $current_dir/build/web-firewalld/manifest/config/config.yaml
mv $current_dir/build/web-firewalld/manifest/config/config.yaml.prod $current_dir/build/web-firewalld/manifest/config/config.yaml
rm -rf ~/firewalld-web