-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·59 lines (50 loc) · 1.36 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
#!/bin/bash
usage()
{
cat << EOF
Build Infonova Mesos Docker images
Usage : $(basename $0) -v <image-version>
-h | --help : Show this message
-v | --version : Version to use for the images
exampl :
$(basename $0) -v 1.7.2-docker-18.06.1-ce
EOF
}
# Options parsing
while (($#)); do
case "$1" in
-h | --help) usage; exit 0;;
-v | --version) VERSION="${2}"; shift 2;;
*)
usage
echo "ERROR : Unknown option"
exit 3
;;
esac
done
if [ -z ${VERSION} ]; then
usage
exit 3
fi
BASEIMAGE=infonova/mesos:${VERSION}
MASTERIMAGE=infonova/mesos-master:${VERSION}
AGENTIMAGE=infonova/mesos-agent:${VERSION}
echo "Building Docker images with version: ${VERSION}"
#for dockerfile in `find . -name Dockerfile | tac`; do
# #echo ${dockerfile}
# type="$(cut -d '/' -f2 <<<"${dockerfile}")"
# #echo ${type}
# dockerfile="$(dirname ${dockerfile})"
# #echo ${dockerfile}
# docker build -t infonova/mesos-${type}:${VERSION} ${dockerfile}
#done
docker build -t ${BASEIMAGE} .
docker build -t ${MASTERIMAGE} ./master
docker build -t ${AGENTIMAGE} ./agent
echo "Build went well. Do you want to push? (y/n)"
read do_push
if [ "y" = "${do_push}" ]; then
docker push ${BASEIMAGE}
docker push ${MASTERIMAGE}
docker push ${AGENTIMAGE}
fi