summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaibin Huang <haibin.huang@intel.com>2019-03-07 11:16:16 +0800
committerHaibin Huang <haibin.huang@intel.com>2019-03-07 11:28:40 +0800
commit57ad556cdbda12ecce07777c812695771f1f7398 (patch)
treef2d7b4841e323576dab3d97ea2b579b6d6564d34
parent3eb43f5d5abeede5489f878094bd30607e8a17a0 (diff)
Optimize docker image footprint for pike
Rebase to python:2-slim Remove unused pip packages Change-Id: I0ba6767d71c1d4e57edb7d41315569ffac8ce494 Issue-ID: MULTICLOUD-517 Signed-off-by: Haibin Huang <haibin.huang@intel.com>
-rw-r--r--pike/docker/Dockerfile24
-rw-r--r--pike/requirements.txt6
-rw-r--r--pike/test-requirements.txt5
3 files changed, 22 insertions, 13 deletions
diff --git a/pike/docker/Dockerfile b/pike/docker/Dockerfile
index 9a3f3231..4e861b79 100644
--- a/pike/docker/Dockerfile
+++ b/pike/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}
@@ -32,16 +32,20 @@ ENV AAI_PASSWORD "AAI"
EXPOSE 9007
RUN groupadd -r onap && useradd -r -g onap onap
-WORKDIR /opt/pike
-RUN apt-get update && apt-get install -y memcached unzip
-RUN wget -O /opt/multicloud-openstack-pike.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.openstack&a=multicloud-openstack-pike&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-pike.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.openstack&a=multicloud-openstack-pike&e=zip&v=1.3.0-SNAPSHOT" && \
unzip -q -o -B /opt/multicloud-openstack-pike.zip -d /opt/ && \
- rm -f /opt/multicloud-openstack-pike.zip
+ rm -f /opt/multicloud-openstack-pike.zip && \
+ pip install -r /opt/pike/requirements.txt && \
+ apt-get --purge remove -y wget unzip gcc && \
+ apt-get -y autoremove && \
+ chown onap:onap /opt/pike -R
+
RUN mkdir -p /var/log/onap/multicloud/openstack/pike/
-#COPY ./ .
-RUN pip install -r requirements.txt
-RUN chown onap:onap /opt/pike -R
USER onap
-
-CMD "/opt/pike/run.sh"
+WORKDIR /opt/pike
+CMD /bin/sh -c "/opt/pike/run.sh"
diff --git a/pike/requirements.txt b/pike/requirements.txt
index 04c1b47a..ea5aa649 100644
--- a/pike/requirements.txt
+++ b/pike/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/pike/test-requirements.txt b/pike/test-requirements.txt
index 97044b5c..cc3059e2 100644
--- a/pike/test-requirements.txt
+++ b/pike/test-requirements.txt
@@ -1 +1,6 @@
+# for unit test
+coverage==4.2
+mock==2.0.0
+unittest_xml_reporting==1.12.0
+
pylint # GPLv2