Optimize Docker image footprint 82/79582/6
authorBin Yang <bin.yang@windriver.com>
Mon, 4 Mar 2019 04:30:40 +0000 (04:30 +0000)
committerBin Yang <bin.yang@windriver.com>
Tue, 5 Mar 2019 03:33:33 +0000 (03:33 +0000)
Rebase to python:2-slim
Remove unused pip packages

Change-Id: Idc9dfdc11d4792a63c7c144587c13705e87bb4bc
Issue-ID: MULTICLOUD-505
Signed-off-by: Bin Yang <bin.yang@windriver.com>
multivimbroker/docker/Dockerfile
multivimbroker/docker/pecan/Dockerfile [new file with mode: 0644]
multivimbroker/pecan-requirements.txt [new file with mode: 0644]
multivimbroker/requirements.txt
multivimbroker/run.sh
multivimbroker/test-requirements.txt [new file with mode: 0644]
multivimbroker/tox.ini
multivimbroker/uwsgi-requirements.txt [new file with mode: 0644]

index 1525e47..cda6d49 100644 (file)
@@ -1,4 +1,4 @@
-FROM python:2
+FROM python:2-slim
 
 ENV MSB_ADDR "127.0.0.1"
 ENV MSB_PORT "80"
@@ -14,12 +14,15 @@ RUN groupadd -r onap && useradd -r -g onap onap
 
 # COPY ./ /opt/multivimbroker/
 RUN apt-get update && \
-    apt-get install -y unzip && \
+    apt-get install -y wget unzip gcc && \
     cd /opt/ && \
     wget -O multicloud-framework.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.framework.broker&a=multicloud-framework-broker&e=zip&v=1.2.3-SNAPSHOT" && \
     unzip -q -o -B multicloud-framework.zip && \
     rm -f multicloud-framework.zip && \
     pip install -r /opt/multivimbroker/requirements.txt && \
+    pip install -r /opt/multivimbroker/uwsgi-requirements.txt && \
+    apt-get --purge remove -y wget unzip gcc && \
+    apt-get -y autoremove && \
     chown onap:onap /opt/multivimbroker -R
 
 USER onap
diff --git a/multivimbroker/docker/pecan/Dockerfile b/multivimbroker/docker/pecan/Dockerfile
new file mode 100644 (file)
index 0000000..60695b0
--- /dev/null
@@ -0,0 +1,31 @@
+FROM python:2-slim
+
+ENV MSB_ADDR "127.0.0.1"
+ENV MSB_PORT "80"
+ENV AAI_ADDR "aai.api.simpledemo.openecomp.org"
+ENV AAI_PORT "8443"
+ENV AAI_SCHEMA_VERSION "v11"
+ENV AAI_USERNAME "AAI"
+ENV AAI_PASSWORD "AAI"
+
+EXPOSE 9001
+
+RUN groupadd -r onap && useradd -r -g onap onap
+
+# COPY ./ /opt/multivimbroker/
+RUN apt-get update && \
+    apt-get install -y wget unzip gcc && \
+    cd /opt/ && \
+    wget -O multicloud-framework.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.framework.broker&a=multicloud-framework-broker&e=zip&v=1.2.3-SNAPSHOT" && \
+    unzip -q -o -B multicloud-framework.zip && \
+    rm -f multicloud-framework.zip && \
+    pip install -r /opt/multivimbroker/requirements.txt && \
+    pip install -r /opt/multivimbroker/pecan-requirements.txt && \
+    apt-get --purge remove -y wget unzip gcc && \
+    apt-get -y autoremove && \
+    chown onap:onap /opt/multivimbroker -R
+
+USER onap
+
+WORKDIR /opt/multivimbroker
+CMD /bin/sh -c /opt/multivimbroker/run.sh
diff --git a/multivimbroker/pecan-requirements.txt b/multivimbroker/pecan-requirements.txt
new file mode 100644 (file)
index 0000000..4e76b5e
--- /dev/null
@@ -0,0 +1,6 @@
+# for pecan framework
+pecan>=1.2.1
+oslo.concurrency>=3.21.0
+oslo.config>=4.11.0
+oslo.service>=1.25.0
+eventlet>=0.20.0
index 0f4a143..e3001ac 100644 (file)
@@ -6,36 +6,36 @@ djangorestframework==3.3.3
 poster==0.8.1
 
 # redis cache
-redis==2.10.5
+redis==2.10.5
 
 # for access redis cache
-redisco==0.1.4
-django-redis-cache==0.13.1
+redisco==0.1.4
+django-redis-cache==0.13.1
 
 # for call rest api
 httplib2==0.9.2
 
 # for call openstack api
-python-keystoneclient==3.6.0
-python-glanceclient==2.5.0
-python-neutronclient==6.0.0
+python-keystoneclient==3.6.0
+python-glanceclient==2.5.0
+python-neutronclient==6.0.0
 
 # for unit test
-django-nose>=1.4.0
-coverage==4.2
-mock==2.0.0
-unittest_xml_reporting==1.12.0
+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
 
 # for pecan framework
-pecan>=1.2.1
-oslo.concurrency>=3.21.0
-oslo.config>=4.11.0
-oslo.service>=1.25.0
-eventlet>=0.20.0
+pecan>=1.2.1
+oslo.concurrency>=3.21.0
+oslo.config>=4.11.0
+oslo.service>=1.25.0
+eventlet>=0.20.0
 
 # uwsgi for parallel processing
-uwsgi
+uwsgi
 
index 9e1542b..9eaf2b3 100755 (executable)
@@ -38,4 +38,4 @@ else
     done
 
     tail -F  $logDir/multivimbroker.log
-fi
\ No newline at end of file
+fi
diff --git a/multivimbroker/test-requirements.txt b/multivimbroker/test-requirements.txt
new file mode 100644 (file)
index 0000000..e39b30b
--- /dev/null
@@ -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
index 1e54370..ef0387e 100644 (file)
@@ -6,7 +6,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 multivimbroker
diff --git a/multivimbroker/uwsgi-requirements.txt b/multivimbroker/uwsgi-requirements.txt
new file mode 100644 (file)
index 0000000..06a4b87
--- /dev/null
@@ -0,0 +1,3 @@
+# uwsgi for parallel processing
+uwsgi
+

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use