-
Notifications
You must be signed in to change notification settings - Fork 6
/
get-docker-opts.sh
executable file
·55 lines (45 loc) · 1.17 KB
/
get-docker-opts.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
DEFAULT=0
if [ "$1" = "--default" ]; then
shift
DEFAULT=1
fi
source services.sh
function echo_service_if_exists {
echo "$DATA_SERVICES $LB_SERVICE $COSCALE_SERVICES" | grep -o $1
}
if [ $DEFAULT == 0 ] && [ -f get-docker-opts.override ]; then
exec ./get-docker-opts.override $*
else
SERVICE=$1
LINKFILE=links/$SERVICE
LINKS=""
if [ -f $LINKFILE ]; then
for ENTRY in $(<$LINKFILE); do
if [[ "$(echo_service_if_exists $ENTRY)" != "" ]]; then
LINKS="${LINKS}--link coscale_${ENTRY}:${ENTRY} "
fi
done
fi
EXPOSED=""
if [ -f expose/$SERVICE ]; then
EXPOSED=$(cat expose/$SERVICE)
fi
VOLUMEFILE=volumes/$SERVICE
VOLUMES=""
if [ -f $VOLUMEFILE ]; then
for ENTRY in $(<$VOLUMEFILE); do
if [[ "$ENTRY" != "/"* ]]; then
ENTRY=$(pwd)/$ENTRY
fi
VOLUMES="${VOLUMES}-v ${ENTRY}:z "
done
fi
#LOG_ROTATE="--log-opt max-size=100m --log-opt max-file=10 "
if [ -f misc/$SERVICE ]; then
MISC=$(cat misc/$SERVICE)
else
MISC=""
fi
echo "$LINKS $EXPOSED $VOLUMES $LOG_ROTATE $MISC"
fi