-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
99 lines (77 loc) · 1.49 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
declare -a gbulid=("client" "server")
whatuse="all"
tabel_point="client,server"
echo "Let's build :)"
gonline="no"
cekif(){
if [[ "all" == *"$whatuse"* ]]; then
whatuse=$tabel_point
fi
}
bulid()
{
cekif
echo "Start build..."
for i in "${gbulid[@]}";
do
if [[ $whatuse == *"$i"* ]]; then
echo "$i...."
cd "$i" || exit;
docker build -t "repo.volcanoyt.com/p2pcam_$i" -f Dockerfile .
cd ..
if [[ $gonline == *"yes"* ]]; then
echo "Start push to our server"
docker push repo.volcanoyt.com/base_"$i"
fi
else
echo "Skip $i"
fi
done
}
tes()
{
echo "Start Tes Mode..."
for i in "${gbulid[@]}";
do
if [[ $whatuse == *"$i"* ]]; then
bulid
if [[ $whatuse == *"client"* ]]; then
docker run --rm -it -p 3002:3000/tcp repo.volcanoyt.com/p2pcam_client:latest
fi
if [[ $whatuse == *"server"* ]]; then
docker run --rm -it -p 3001:3000/tcp repo.volcanoyt.com/p2pcam_server:latest
fi
else
echo "Skip $i"
fi
done
}
push()
{
cekif
echo "Start push..."
for i in "${gbulid[@]}";
do
if [[ $whatuse == *"$i"* ]]; then
echo "$i...."
docker push repo.volcanoyt.com/p2pcam_"$i"
else
echo "Skip $i"
fi
done
}
if [ $# -eq 0 ]; then
echo "Type build like bash run.sh bulid etc,etc,etc"
else
tmpuse="$2"
if [ -n "$tmpuse" ]
then
whatuse="$tmpuse"
fi
gonline="$3"
case $1 in bulid|push|tes)
$1
;;
esac
fi