-
Notifications
You must be signed in to change notification settings - Fork 27
/
common.sh
33 lines (28 loc) · 1.09 KB
/
common.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
# Behavior used by all our scripts - trap errors and report to user if any command fails
abort() {
errcode=$?
[ "$errcode" != "0" ] && echo "Command failed with error $errcode" >&2
exit $errcode
}
trap 'abort' INT TERM EXIT
set -e
# Use versioned dependency images. We run busybox+ubuntu from the command
# line, and their programs' calling conventions have been known to change.
BUSYBOX_IMAGE="library/busybox:1.27.2"
UBUNTU_IMAGE="library/ubuntu:17.10"
eval "$(grep -v -E '^#|^OV_WELCOME_BANNER|^$' "$(dirname "$0")"/config/overview.defaults.env | sed 's/^/export /')"
eval "$(grep -v -E '^#|^OV_WELCOME_BANNER|^$' "$(dirname "$0")"/config/overview.env | sed 's/^/export /')"
# docker_compose: like "docker-compose" but with the arguments we want
docker_compose() {
maybe_ssl1=""
maybe_ssl2=""
if grep -q -E '^OV_DOMAIN_NAME=.' "$(dirname "$0")"/config/overview.env; then
maybe_ssl1="-f"
maybe_ssl2="$(dirname "$0")"/config/overview-ssl.yml
fi
docker-compose \
-f "$(dirname "$0")"/config/overview.yml \
--project-name overviewlocal \
$maybe_ssl1 $maybe_ssl2 \
"$@"
}