summaryrefslogtreecommitdiffstats
path: root/res/docker/docker-entrypoint.sh
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-09-04 15:37:05 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-09-04 15:37:05 +0800
commitdf054edf1951536181eeb7918ba9362471a19358 (patch)
treead4a25adb7a14e335eb45e7730581bc73d91c902 /res/docker/docker-entrypoint.sh
parent09c42913e057f4f0e5507e9c994827cd8af33f60 (diff)
Add vnfres docker build files
Add docker build files to build vfc gvnfm vnfres docker images. Change-Id: I8bc366de6d750bce627716c96f1feabb44a1c035 Issue-ID: VFC-255 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
Diffstat (limited to 'res/docker/docker-entrypoint.sh')
-rw-r--r--res/docker/docker-entrypoint.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/res/docker/docker-entrypoint.sh b/res/docker/docker-entrypoint.sh
new file mode 100644
index 0000000..1721831
--- /dev/null
+++ b/res/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
+vfc/gvnfm/vnfres/res/docker/instance_config.sh
+
+# microservice-specific one-time initialization
+vfc/gvnfm/vnfres/res/docker/instance_init.sh
+
+date > init.log
+
+# Start the microservice
+vfc/gvnfm/vnfres/res/docker/instance_run.sh