-
Notifications
You must be signed in to change notification settings - Fork 7
/
mkbuilder.sh
executable file
·65 lines (59 loc) · 1.86 KB
/
mkbuilder.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
64
65
#!/bin/sh
ETC_PATH="`dirname $0`"/../etc
. ${ETC_PATH}/config.sh
if [ ! -x "$(command -v docker)" ]; then
printf "Cannot find docker\n"
exit 1
fi
# Process arguments
while :; do
case $1 in
-d)
if [ -n "$2" ]; then
DEBIAN_RELEASE=$2
shift
else
printf "Cannot pass -d without Debian release argument (e.g. ${DEBIAN_RELEASE})\n" >&2
exit 1
fi
;;
-t)
if [ -n "$2" ]; then
FREESWITCH_TAG=$2
shift
else
printf "Cannot pass -t without FreeSWITCH tag argument (e.g. ${FREESWITCH_TAG})\n" >&2
exit 1
fi
;;
-r)
if [ -n "$2" ]; then
BUILDER_REPOSITORY=$2
shift
else
printf "Cannot pass -r without builder Docker image repository name argument (e.g. ${BUILDER_REPOSITORY})\n" >&2
exit 1
fi
;;
-h)
printf "slimswitch mkbuilder.sh utility\n"
printf "https://github.com/rtckit/slimswitch\n\n"
printf "Usage: %s [-d <Debian release>] [-t <FreeSWITCH tag>] [-r <Builder image repository>]\n" "$0"
printf "\t-d Base Debian image tag (default: %s)\n" "${DEBIAN_RELEASE}"
printf "\t-t Builder image tag (default: %s)\n" "${FREESWITCH_TAG}"
printf "\t-r Builder image repository (default: %s)\n" "${BUILDER_REPOSITORY}"
exit 0
;;
-?*)
printf "Unknown argument %s\n" "$1" >&2
exit 1
;;
*)
break
esac
shift
done
docker build \
--build-arg FREESWITCH_TAG=${FREESWITCH_TAG} \
-t ${BUILDER_REPOSITORY}:${FREESWITCH_TAG} \
-f ${ETC_PATH}/Dockerfile ${ETC_PATH}