summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2019-03-11 16:50:56 +0800
committerEthan Lynn <ethanlynnl@vmware.com>2019-03-11 16:56:23 +0800
commite6d3b542e4fc228108b39d514e994b5582d6a073 (patch)
tree26d8f10e42f529ce89eb7d59af1966503b806bca
parent753a4331b8ff46c1abcff1cb28e09b533755e44f (diff)
Optimize MultiCloud vio plugin docker image size
Reduce vio plugin image size Change-Id: I4ec74b09b98cf5f776ef5684499accb66abce5b8 Issue-ID: MULTICLOUD-524 Signed-off-by: Ethan Lynn <ethanlynnl@vmware.com>
-rw-r--r--vio/docker/Dockerfile18
-rw-r--r--vio/requirements.txt6
-rw-r--r--vio/test-requirements.txt5
-rw-r--r--vio/tox.ini5
4 files changed, 18 insertions, 16 deletions
diff --git a/vio/docker/Dockerfile b/vio/docker/Dockerfile
index 02a6f9d..0330232 100644
--- a/vio/docker/Dockerfile
+++ b/vio/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:2
+FROM python:2-slim
ENV MSB_ADDR "127.0.0.1"
ENV MSB_PORT "80"
@@ -12,20 +12,20 @@ ENV MR_PORT "3904"
EXPOSE 9004
-RUN apt-get update && \
- apt-get install -y unzip && \
- apt-get install -y curl && \
- apt-get install -y wget && \
- apt-get install -y redis-server
-
RUN groupadd -r onap && useradd -r -g onap onap
-RUN cd /opt/ && \
+RUN apt-get update && \
+ apt-get install -y unzip wget curl gcc && \
+ cd /opt/ && \
wget -q -O multicloud-vio.zip 'https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.openstack.vmware&a=multicloud-openstack-vmware&v=1.3.0-SNAPSHOT&e=zip' && \
unzip multicloud-vio.zip && \
rm -rf multicloud-vio.zip && \
pip install -r /opt/vio/requirements.txt && \
- chown onap:onap -R /opt/vio/
+ mkdir -p /var/log/onap/multicloud/vio && \
+ chmod a+rw /var/log/onap/multicloud/vio && \
+ chown onap:onap -R /opt/vio/ && \
+ apt-get --purge remove -y unzip gcc && \
+ apt-get -y autoremove
USER onap
diff --git a/vio/requirements.txt b/vio/requirements.txt
index ee1bca1..eec60b7 100644
--- a/vio/requirements.txt
+++ b/vio/requirements.txt
@@ -17,12 +17,6 @@ openstacksdk==0.9.15
os-client-config==1.29.0
python-cinderclient==3.5.0
-# for unit test
-django-nose>=1.4.0
-coverage==4.2
-mock==2.0.0
-unittest_xml_reporting==1.12.0
-
# for onap logging
onappylog>=1.0.8
diff --git a/vio/test-requirements.txt b/vio/test-requirements.txt
new file mode 100644
index 0000000..1eefa30
--- /dev/null
+++ b/vio/test-requirements.txt
@@ -0,0 +1,5 @@
+# for unit test
+django-nose>=1.4.0
+coverage==4.2
+mock==2.0.0
+unittest_xml_reporting==1.12.0 \ No newline at end of file
diff --git a/vio/tox.ini b/vio/tox.ini
index 7fd641e..5b2ab8e 100644
--- a/vio/tox.ini
+++ b/vio/tox.ini
@@ -18,7 +18,10 @@ skipsdist = true
downloadcache = ~/cache/pip
[testenv]
-deps = -r{toxinidir}/requirements.txt
+deps =
+ -r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+
commands =
/usr/bin/find . -type f -name "*.py[c|o]" -delete
python manage.py test vio