summaryrefslogtreecommitdiffstats
path: root/docker/docker-entrypoint.sh
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2017-09-01 14:00:05 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2017-09-01 14:00:05 +0800
commitf40578b051e1d230035eb300436b30dd77b41888 (patch)
tree4bb74c489f66d38adce1dbc2a35531baa7d72ae1 /docker/docker-entrypoint.sh
parent8f82bb88330a9db6f27d53a6c822f58338cc7f68 (diff)
Update dockerfile of vfc-nfvo-lcm
Add entrypoint to dockerfile Change-Id: Iaf5f42ccc056062f2031e88437253ee8927eb697 Issue-Id: VFC-225 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'docker/docker-entrypoint.sh')
-rwxr-xr-xdocker/docker-entrypoint.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
new file mode 100755
index 00000000..90341e83
--- /dev/null
+++ b/docker/docker-entrypoint.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+if [ -z "$SERVICE_IP" ]; then
+ export SERVICE_IP=`hostname -i`
+fi
+echo "SERVICE_IP=$SERVICE_IP"
+
+if [ -z "$MYSQL_ROOT_PASSWORD" ]; then
+ export MYSQL_ROOT_PASSWORD="root"
+fi
+echo "MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD"
+
+if [ -z "$MSB_ADDR" ]; then
+ echo "Missing required variable MSB_ADDR: Microservices Service Bus address <ip>:<port>"
+ exit 1
+fi
+echo "MSB_ADDR=$MSB_ADDR"
+
+# Wait for MSB initialization
+echo "Wait for MSB initialization"
+for i in {1..20}; do
+ curl -sS -m 1 $MSB_ADDR > /dev/null && break
+ sleep $i
+done
+
+# Configure service based on docker environment variables
+./instance-config.sh
+
+# microservice-specific one-time initialization
+./instance-init.sh
+
+date > init.log
+
+# Start the microservice
+./instance-run.sh