forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·63 lines (51 loc) · 1.07 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
#!/usr/bin/env bash
##############################################################
# This script is used to compile StarRocks docker image
# Usage:
# sh build.sh -b branch {image}
##############################################################
set -eo pipefail
ROOT=`dirname "$0"`
ROOT=`cd "$ROOT"/..; pwd`
# Check args
usage() {
echo "
Usage: $0 <options>
Optional options:
-b build for branch
Eg.
$0 starrocks
$0 -b branch-2.2
"
exit 1
}
OPTS=$(getopt \
-n $0 \
-o 'hb:' \
-l 'help' \
-- "$@")
if [ $? != 0 ] ; then
usage
fi
eval set -- "$OPTS"
HELP=0
BRANCH="main"
IMAGENAME="starrocks/starrocks"
while true; do
case "$1" in
-h) HELP=1; shift ;;
--help) HELP=1; shift ;;
-b) BRANCH=$2; shift 2 ;;
--) shift ; break ;;
*) echo "Internal error" ; exit 1 ;;
esac
done
if [[ ${HELP} -eq 1 ]]; then
usage
exit
fi
if [[ $# -eq 1 ]];then
IMAGENAME=$1
fi
cp dockerignore ${ROOT}/.dockerignore
docker build ${ROOT} -f Dockerfile --build-arg BRANCH=$BRANCH -t $IMAGENAME