forked from kpx-dev/ansible-zookeeper
-
Notifications
You must be signed in to change notification settings - Fork 114
/
build.sh
executable file
·55 lines (44 loc) · 897 Bytes
/
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
DOCKERNAME="ansibleshipyard/ansible-zookeeper"
DOCKER_DIR="dockerfiles"
# TAGS=(ubuntu centos)
TAGS=(ubuntu)
CONTEXT=.
usage() {
local tag=$1
echo
echo "To pull it"
echo " docker pull $DOCKERNAME:$tag"
echo
echo "To use this docker:"
echo " docker run -d -P $DOCKERNAME:$tag"
echo
echo "To run in interactive mode for debug:"
echo " docker run -t -i $DOCKERNAME:$tag bash"
echo
}
build() {
local tag=$1
# pushd $tag
# Builds the image
cmd="docker build -f $DOCKER_DIR/$tag/Dockerfile --force-rm -t $DOCKERNAME:$tag $CONTEXT"
echo "Command to execute: [$cmd]"
$cmd
if [ $? == 0 ]; then
echo "$tag build successful!"
usage $tag
return 0
else
return 1
fi;
}
main() {
# pushd $DOCKER_DIR
for tag in ${TAGS[@]}; do
build ${tag}
if [ $? != 0 ]; then
echo "$tag build failed!"
fi;
done
}
main