-
Notifications
You must be signed in to change notification settings - Fork 3
/
bulkbuild.sh
executable file
·64 lines (62 loc) · 990 Bytes
/
bulkbuild.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
#!/bin/sh
FORCE=0
PUSH=0
BUILD=0
DELETE=0
while getopts "BDFP" opt
do
case $opt in
B)
BUILD=1
;;
F)
FORCE=1
;;
P)
PUSH=1
;;
D)
DELETE=1
;;
*)
echo "usage: buildBuild [flags]" >&2
echo "\nwhere flags -" >&2
echo "-F force rebuild" >&2
;;
esac
done
echo "===================== Starting ===================="
DOCKERS=`find . -maxdepth 1 -type d | grep -Ev "^\.$|^\./\.git"`
DOCKER=(${DOCKERS})
for (( i=0; i<${#DOCKER[@]}; i++ ))
do
if [ ! -f ${DOCKER[$i]}/Makefile ]; then
continue
if [ ${DELETE} -eq 1 ]; then
cd ${DOCKER[$i]}
make clean
cd ${DIR}
fi
RC=0
if [ ${FORCE} -eq 1 -a ${BUILD} -eq 1 ]; then
cd ${DOCKER[$i]}
make clean
cd ${DIR}
fi
if [ ${BUILD} -eq 1 ]; then
cd ${DOCKER[$i]}
make
RC=$?
cd ${DIR}
fi
if [ ${RC} -eq 0 -a ${PUSH} -eq 1 ]; then
cd ${DOCKER[$i]}
make push
RC=$?
cd ${DIR}
fi
echo "${IMAGE} ---------------------------------------------------- Rc:" $RC
echo
done
cd ${DIR}
exit