-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
61 lines (52 loc) · 1.54 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
#!/bin/bash -e
##########################################################################################
# Chef server docker image
# 1. Build a docker image of the chef server as specified in the Dockerfile
# 2. Push the docker image to DTR
#
# Author:
# Ruifeng Ma <[email protected]>
# Date:
# 2018-Jan-16
##########################################################################################
export DTR_HOST='sla-dtr.sby.ibm.com'
export DTR_ORG='gts-tia-sdad-sla-core-dev'
ops='release:,dtr-user:,dtr-pass:'
declare {RELEASE,DTR_USER,DTR_PASS}=''
USAGE="\n\033[0;36mUsage: $0 [--release cs_<VERSION>] [--dtr-user dtr_username] [--dtr-pass dtr_password]\033[0m\n"
OPTIONS=$(getopt --options '' --longoptions ${ops} --name "$0" -- "$@")
[[ $? != 0 ]] && exit 3
eval set -- "${OPTIONS}"
while true
do
case "${1}" in
--release)
RELEASE="$2"
shift 2
;;
--dtr-user)
DTR_USER="$2"
shift 2
;;
--dtr-pass)
DTR_PASS="$2"
shift 2
;;
--)
shift
break
;;
*)
echo -e "\n\nUndefined options given!"
echo "$*"
echo -e "${USAGE}"
exit 3
;;
esac
done
echo -e "[$(date)]\tBuilding docker image ..."
docker build -t $DTR_HOST/$DTR_ORG/cs-image:$RELEASE ./
# docker login -u $DTR_USER -p $DTR_PASS $DTR_HOST
# docker push $DTR_HOST/$DTR_ORG/cs-image:$RELEASE
# docker logout $DTR_HOST
echo -e "[$(date)]\tBuild completed."