summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShashank Kumar Shankar <shashank.kumar.shankar@intel.com>2017-09-01 14:34:32 -0700
committerShashank Kumar Shankar <shashank.kumar.shankar@intel.com>2017-09-01 14:38:50 -0700
commit8790d0ae277f350553bd4df8129bd0771bd48a3b (patch)
treeee601dc90321ade5d5ed62b0e4da77c3e8187949
parent51af25d420b6e6cab9ad6ecad26fd58ab7f145b9 (diff)
Fix Docker Image building for NFVO LCM
This patch fixes various issues in NFVO LCM docker image building. Change-Id: Icdc475d554f8f6327c78c6560c3c9aa49974271d Issue-Id: VFC-231 Signed-off-by: Shashank Kumar Shankar <shashank.kumar.shankar@intel.com>
-rwxr-xr-xdocker/Dockerfile16
-rwxr-xr-xdocker/docker-entrypoint.sh6
-rwxr-xr-xdocker/instance_config.sh26
-rwxr-xr-xdocker/instance_init.sh1
-rwxr-xr-xdocker/instance_run.sh1
-rwxr-xr-xdocker/run_image.sh2
6 files changed, 29 insertions, 23 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index e474e049..4093c80d 100755
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -6,23 +6,26 @@ ARG HTTPS_PROXY=${HTTPS_PROXY}
ENV http_proxy $HTTP_PROXY
ENV https_proxy $HTTPS_PROXY
+RUN echo "mysql-server mysql-server/root_password password root" | debconf-set-selections
+RUN echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections
+
RUN apt-get update && \
- apt-get install -y python-devel && \
apt-get install -y python-virtualenv && \
apt-get install -y python-setuptools && \
apt-get install -y python-dev && \
apt-get install -y python-pip && \
- apt-get install -y openssl-devel && \
- apt-get install -y mysql-devel && \
apt-get install -y gcc && \
- apt-get install -y libffi-devel && \
- apt-get install -y redis && \
apt-get install -y libmysqlclient-dev && \
apt-get install -y redis-server && \
apt-get install -y mysql-server && \
apt-get install -y mysql-client && \
apt-get install -y wget && \
- apt-get install -y unzip
+ apt-get install -y unzip && \
+ apt-get install -y curl && \
+ apt-get install -y build-essential && \
+ apt-get install -y libssl-dev && \
+ apt-get install -y libffi-dev && \
+ yes | pip install cryptography
ADD . /service
WORKDIR /service
@@ -34,6 +37,7 @@ RUN wget -q -O vfc-nfvo-lcm.zip 'https://nexus.onap.org/service/local/artifact/m
EXPOSE 8403
EXPOSE 3306
+EXPOSE 6379
WORKDIR /service
ENTRYPOINT vfc/nfvo/lcm/docker/docker-entrypoint.sh
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
index 90341e83..16738ac6 100755
--- a/docker/docker-entrypoint.sh
+++ b/docker/docker-entrypoint.sh
@@ -24,12 +24,12 @@ for i in {1..20}; do
done
# Configure service based on docker environment variables
-./instance-config.sh
+vfc/nfvo/lcm/docker/instance_config.sh
# microservice-specific one-time initialization
-./instance-init.sh
+vfc/nfvo/lcm/docker/instance_init.sh
date > init.log
# Start the microservice
-./instance-run.sh
+vfc/nfvo/lcm/docker/instance_run.sh
diff --git a/docker/instance_config.sh b/docker/instance_config.sh
index 6e44b47b..06e0d027 100755
--- a/docker/instance_config.sh
+++ b/docker/instance_config.sh
@@ -4,30 +4,30 @@ MSB_IP=`echo $MSB_ADDR | cut -d: -f 1`
MSB_PORT=`echo $MSB_ADDR | cut -d: -f 2`
if [ $MSB_IP ]; then
- sed -i "s|MSB_SERVICE_IP.*|MSB_SERVICE_IP = '$MSB_IP'|" lcm/pub/config/config.py
+ sed -i "s|MSB_SERVICE_IP.*|MSB_SERVICE_IP = '$MSB_IP'|" vfc/nfvo/lcm/lcm/pub/config/config.py
fi
if [ $MSB_PORT ]; then
- sed -i "s|MSB_SERVICE_PORT.*|MSB_SERVICE_PORT = '$MSB_PORT'|" lcm/pub/config/config.py
+ sed -i "s|MSB_SERVICE_PORT.*|MSB_SERVICE_PORT = '$MSB_PORT'|" vfc/nfvo/lcm/lcm/pub/config/config.py
fi
if [ $SERVICE_IP ]; then
- sed -i "s|\"ip\": \".*\"|\"ip\": \"$SERVICE_IP\"|" lcm/pub/config/config.py
- sed -i "s|127\.0\.0\.1|$SERVICE_IP|" lcm/run.sh
- sed -i "s|127\.0\.0\.1|$SERVICE_IP|" lcm/stop.sh
+ sed -i "s|\"ip\": \".*\"|\"ip\": \"$SERVICE_IP\"|" vfc/nfvo/lcm/lcm/pub/config/config.py
+ sed -i "s|127\.0\.0\.1|$SERVICE_IP|" vfc/nfvo/lcm/run.sh
+ sed -i "s|127\.0\.0\.1|$SERVICE_IP|" vfc/nfvo/lcm/stop.sh
fi
if [ $REDIS_HOST ]; then
- sed -i "s|REDIS_HOST.*|REDIS_HOST = '$REDIS_HOST'|" lcm/pub/config/config.py
+ sed -i "s|REDIS_HOST.*|REDIS_HOST = '$REDIS_HOST'|" vfc/nfvo/lcm/lcm/pub/config/config.py
fi
if [ $SDC_BASE_URL ]; then
- sed -i "s|SDC_BASE_URL.*|SDC_BASE_URL = '$SDC_BASE_URL'|" lcm/pub/config/config.py
+ sed -i "s|SDC_BASE_URL.*|SDC_BASE_URL = '$SDC_BASE_URL'|" vfc/nfvo/lcm/lcm/pub/config/config.py
fi
-sed -i "s|DB_NAME.*|DB_NAME = 'vfcnfvolcm'|" lcm/pub/config/config.py
-sed -i "s|DB_USER.*|DB_USER = 'vfcnfvolcm'|" lcm/pub/config/config.py
-sed -i "s|DB_PASSWD.*|DB_PASSWD = 'vfcnfvolcm'|" lcm/pub/config/config.py
+sed -i "s|DB_NAME.*|DB_NAME = 'vfcnfvolcm'|" vfc/nfvo/lcm/lcm/pub/config/config.py
+sed -i "s|DB_USER.*|DB_USER = 'vfcnfvolcm'|" vfc/nfvo/lcm/lcm/pub/config/config.py
+sed -i "s|DB_PASSWD.*|DB_PASSWD = 'vfcnfvolcm'|" vfc/nfvo/lcm/lcm/pub/config/config.py
# Configure MYSQL
if [ -z "$MYSQL_ADDR" ]; then
@@ -39,7 +39,7 @@ else
MYSQL_PORT=`echo $MYSQL_ADDR | cut -d: -f 2`
fi
echo "MYSQL_ADDR=$MYSQL_ADDR"
-sed -i "s|DB_IP.*|DB_IP = '$MYSQL_IP'|" lcm/pub/config/config.py
-sed -i "s|DB_PORT.*|DB_PORT = $MYSQL_PORT|" lcm/pub/config/config.py
+sed -i "s|DB_IP.*|DB_IP = '$MYSQL_IP'|" vfc/nfvo/lcm/lcm/pub/config/config.py
+sed -i "s|DB_PORT.*|DB_PORT = $MYSQL_PORT|" vfc/nfvo/lcm/lcm/pub/config/config.py
-cat lcm/pub/config/config.py
+cat vfc/nfvo/lcm/lcm/pub/config/config.py
diff --git a/docker/instance_init.sh b/docker/instance_init.sh
index c3a3b54e..f758a71b 100755
--- a/docker/instance_init.sh
+++ b/docker/instance_init.sh
@@ -22,6 +22,7 @@ function start_mysql {
function create_database {
cd /service/vfc/nfvo/lcm/resources/bin
bash initDB.sh root $MYSQL_ROOT_PASSWORD 3306 127.0.0.1
+ cd /service
}
install_python_libs
diff --git a/docker/instance_run.sh b/docker/instance_run.sh
index c1fc0549..b14ee5a4 100755
--- a/docker/instance_run.sh
+++ b/docker/instance_run.sh
@@ -1,6 +1,7 @@
#!/bin/bash
cd /service/vfc/nfvo/lcm
+chmod +x run.sh
./run.sh
while [ ! -f logs/nfvo_lcm.log ]; do
diff --git a/docker/run_image.sh b/docker/run_image.sh
index 5ee07d60..59046bec 100755
--- a/docker/run_image.sh
+++ b/docker/run_image.sh
@@ -1,7 +1,7 @@
#!/bin/bash
function run_lcm {
- docker run -it --name vfc-nslcm -p 3306:3306 -p 8403:8403 onap/vfc/nslcm
+ docker run -it --name vfc-nslcm -p 3306:3306 -p 8403:8403 -e MSB_ADDR=127.0.0.1 onap/vfc/nslcm
}
run_lcm \ No newline at end of file