blob: 646181777659779fd7f2e9442351ab129332c818 [file] [log] [blame]
su622bf5b68992018-04-23 12:02:24 -04001#!/bin/bash
2
3set -e
4
Gary Wu08fc50d2018-05-04 07:32:09 -07005export NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
6
su622bf5b68992018-04-23 12:02:24 -04007# do not change this, it is already matched with the git repo file structure
8DOCKER_FILE_DIR='./docker_files'
9
su622bf5b68992018-04-23 12:02:24 -040010# commands to run docker and docker-compose
11DOCKER_COMPOSE_EXE='/opt/docker/docker-compose'
12
13cd "${DOCKER_FILE_DIR}"
14
15while ! ifconfig |grep "docker0" > /dev/null;
16 do sleep 1
17 echo 'waiting for docker operational'
18done
19
20echo "prep any files with local configurations"
21if ls __* 1> /dev/null 2>&1; then
22 IP_DOCKER0=$(ifconfig docker0 |grep "inet addr" | cut -d: -f2 |cut -d" " -f1)
23 TEMPLATES=$(ls -1 __*)
24 for TEMPLATE in $TEMPLATES
25 do
26 FILENAME=${TEMPLATE//_}
27 if [ ! -z "${IP_DOCKER0}" ]; then
28 sed -e "s/{{ ip.docker0 }}/${IP_DOCKER0}/" "$TEMPLATE" > "$FILENAME"
29 fi
30 done
31fi
32
33if [ -z "$MTU" ]; then
34 export MTU=$(ifconfig docker0 |grep MTU |sed -e 's/.*MTU://' -e 's/\s.*$//')
35fi
36
37echo "starting docker operations"
38${DOCKER_COMPOSE_EXE} up -d --build