forked from datainsider-co/rocket-bi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_all.sh
executable file
·55 lines (49 loc) · 1.05 KB
/
build_all.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 -e
DIR=$(cd $(dirname $0) && pwd)
REGISTRY='datainsiderco'
BUILD=false
PUSH=false
TAG=latest
while [[ $# -gt 0 ]]; do
key="$1"
echo "Recieved key: ${key}"
case $key in
-t)
TAG=$2
shift
;;
build)
BUILD=true
;;
push)
PUSH=true
;;
all)
BUILD=true
PUSH=true
;;
*)
# unknown option
;;
esac
shift # past argument or value
done
echo "Build sources: ${BUILD}"
echo "Push images: ${PUSH}"
if [[ "x$TAG" == "x" ]]; then
echo "Tag name cannot be empty"
exit 1
fi
if [[ "x$BUILD" == "xtrue" ]]; then
cd ${DIR}/rocket-bi-server && ./build.sh
fi
cd $DIR
if [[ "x$PUSH" == "xtrue" ]]; then
echo "Build and push images to registry..."
# rocket-bi-server
docker build -f ${DIR}/rocket-bi-server/Dockerfile -t ${REGISTRY}/rocket-bi-server:${TAG} ${DIR}/rocket-bi-server
docker push ${REGISTRY}/rocket-bi-server:${TAG}
# rocket-bi-web
docker build -f ${DIR}/rocket-bi-web/Dockerfile -t ${REGISTRY}/rocket-bi-web:${TAG} ${DIR}/rocket-bi-web
docker push ${REGISTRY}/rocket-bi-web:${TAG}
fi