summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaibin Huang <haibin.huang@intel.com>2019-03-07 10:55:24 +0800
committerHaibin Huang <haibin.huang@intel.com>2019-03-07 11:04:50 +0800
commit5c21ee369b2fffc8c859ffd1ce8532dbb410808d (patch)
treeeedfa5f71c81959762e9d044f3594fb84355c263
parent746798fe2cc2eb2a749f5e4331c26a5f1dca856f (diff)
Optimize docker image footprint for ocata
Rebase to python:2-slim Remove unused pip packages Change-Id: I255f7c009c9b3f887a5a6e6b11a16ece1a7faed4 Issue-ID: MULTICLOUD-517 Signed-off-by: Haibin Huang <haibin.huang@intel.com>
-rw-r--r--ocata/docker/Dockerfile23
-rw-r--r--ocata/requirements.txt6
-rw-r--r--ocata/test-requirements.txt5
3 files changed, 21 insertions, 13 deletions
diff --git a/ocata/docker/Dockerfile b/ocata/docker/Dockerfile
index bff5706a..985b6442 100644
--- a/ocata/docker/Dockerfile
+++ b/ocata/docker/Dockerfile
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM python:2.7
+FROM python:2-slim
ARG HTTP_PROXY=${HTTP_PROXY}
ARG HTTPS_PROXY=${HTTPS_PROXY}
@@ -33,16 +33,19 @@ EXPOSE 9006
RUN groupadd -r onap && useradd -r -g onap onap
-WORKDIR /opt/ocata
-RUN apt-get update && apt-get install -y memcached unzip
-RUN wget -O /opt/multicloud-openstack-ocata.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.openstack&a=multicloud-openstack-ocata&e=zip&v=1.3.0-SNAPSHOT" && \
+RUN apt-get update && \
+ apt-get install -y memcached wget unzip gcc && \
+ cd /opt/ && \
+ wget -O /opt/multicloud-openstack-ocata.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.openstack&a=multicloud-openstack-ocata&e=zip&v=1.3.0-SNAPSHOT" && \
unzip -q -o -B /opt/multicloud-openstack-ocata.zip -d /opt/ && \
- rm -f /opt/multicloud-openstack-ocata.zip
+ rm -f /opt/multicloud-openstack-ocata.zip && \
+ pip install -r /opt/ocata/requirements.txt && \
+ apt-get --purge remove -y wget unzip gcc && \
+ apt-get -y autoremove && \
+ chown onap:onap /opt/ocata -R
+
RUN mkdir -p /var/log/onap/multicloud/openstack/ocata/
-#COPY ./ .
-RUN pip install -r requirements.txt
-RUN chown onap:onap /opt/ocata -R
USER onap
-
-CMD "/opt/ocata/run.sh"
+WORKDIR /opt/ocata
+CMD /bin/sh -c "/opt/ocata/run.sh"
diff --git a/ocata/requirements.txt b/ocata/requirements.txt
index 67a11b0d..c28da163 100644
--- a/ocata/requirements.txt
+++ b/ocata/requirements.txt
@@ -29,9 +29,9 @@ python-memcached
uwsgi
# for unit test
-coverage==4.2
-mock==2.0.0
-unittest_xml_reporting==1.12.0
+#coverage==4.2
+#mock==2.0.0
+#unittest_xml_reporting==1.12.0
# for onap logging
onappylog>=1.0.8
diff --git a/ocata/test-requirements.txt b/ocata/test-requirements.txt
index 97044b5c..cc3059e2 100644
--- a/ocata/test-requirements.txt
+++ b/ocata/test-requirements.txt
@@ -1 +1,6 @@
+# for unit test
+coverage==4.2
+mock==2.0.0
+unittest_xml_reporting==1.12.0
+
pylint # GPLv2