-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit
More file actions
executable file
·33 lines (29 loc) · 782 Bytes
/
init
File metadata and controls
executable file
·33 lines (29 loc) · 782 Bytes
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
#!/usr/bin/env bash
set -e
get_host_ip() {
if [ -x "$(command -v ip)" ];
then
cmd "$(ip route get 1 | awk '{print $NF;exit}')"
elif [ -x "$(command -v ifconfig)" ];
then
cmd "$(ifconfig | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}')"
else
echo "Unable to retrieve host ip. Aborting ..." 1>&2
exit 1
fi
}
# pull images
for DOCKER_IMAGE in $(cat *.yml | grep image | awk -F ": " '{print $NF}')
do
echo "Checking if ${DOCKER_IMAGE} is present ..."
docker image inspect "${DOCKER_IMAGE}" &> /dev/null ||
docker pull "${DOCKER_IMAGE}" > /dev/null
done
# start containers
docker-compose \
-e HOST_IP="$(get_host_ip)" \
-f compose.proxy.yml \
-f compose.netservices.yml \
-f compose.monitoring.yml \
-f compose.unifi.yml \
up -d