summaryrefslogtreecommitdiffstats
path: root/starlingx
diff options
context:
space:
mode:
authorHaibin Huang <haibin.huang@intel.com>2019-03-07 11:26:42 +0800
committerHaibin Huang <haibin.huang@intel.com>2019-03-07 11:27:40 +0800
commit3eb43f5d5abeede5489f878094bd30607e8a17a0 (patch)
treefbfffe5ac1041ab9f21ff798b8b40cc37b9dddc4 /starlingx
parent5c21ee369b2fffc8c859ffd1ce8532dbb410808d (diff)
Optimize docker image footprint for starlingx
Rebase to python:2-slim Remove unused pip packages Change-Id: Icef1b522b47f999b5c9a18e0a1184e642fbae734 Issue-ID: MULTICLOUD-517 Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Diffstat (limited to 'starlingx')
-rw-r--r--starlingx/docker/Dockerfile24
-rw-r--r--starlingx/requirements.txt6
-rw-r--r--starlingx/test-requirements.txt6
-rw-r--r--starlingx/tox.ini4
4 files changed, 26 insertions, 14 deletions
diff --git a/starlingx/docker/Dockerfile b/starlingx/docker/Dockerfile
index b676e065..a987f4dd 100644
--- a/starlingx/docker/Dockerfile
+++ b/starlingx/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 9009
RUN groupadd -r onap && useradd -r -g onap onap
-WORKDIR /opt/starlingx
-RUN apt-get update && apt-get install -y memcached unzip
-RUN wget -O /opt/multicloud-openstack-starlingx.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.openstack&a=multicloud-openstack-starlingx&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-starlingx.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.openstack&a=multicloud-openstack-starlingx&e=zip&v=1.3.0-SNAPSHOT" && \
unzip -q -o -B /opt/multicloud-openstack-starlingx.zip -d /opt/ && \
- rm -f /opt/multicloud-openstack-starlingx.zip
+ rm -f /opt/multicloud-openstack-starlingx.zip && \
+ pip install -r /opt/starlingx/requirements.txt && \
+ apt-get --purge remove -y wget unzip gcc && \
+ apt-get -y autoremove && \
+ chown onap:onap /opt/starlingx -R
+
RUN mkdir -p /var/log/onap/multicloud/openstack/starlingx/
-#COPY ./ .
-RUN pip install -r requirements.txt
-RUN chown onap:onap /opt/starlingx -R
USER onap
-
-CMD "/opt/starlingx/run.sh"
+WORKDIR /opt/starlingx
+CMD /bin/sh -c "/opt/starlingx/run.sh"
diff --git a/starlingx/requirements.txt b/starlingx/requirements.txt
index f37d41fe..c016f77f 100644
--- a/starlingx/requirements.txt
+++ b/starlingx/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/starlingx/test-requirements.txt b/starlingx/test-requirements.txt
new file mode 100644
index 00000000..cc3059e2
--- /dev/null
+++ b/starlingx/test-requirements.txt
@@ -0,0 +1,6 @@
+# for unit test
+coverage==4.2
+mock==2.0.0
+unittest_xml_reporting==1.12.0
+
+pylint # GPLv2
diff --git a/starlingx/tox.ini b/starlingx/tox.ini
index cd5b6573..09d3a50f 100644
--- a/starlingx/tox.ini
+++ b/starlingx/tox.ini
@@ -27,7 +27,9 @@ max-complexity = 27
[testenv]
setenv =
PYTHONPATH = {toxinidir}/../share
-deps = -r{toxinidir}/requirements.txt
+deps =
+ -r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
commands =
coverage run --branch manage.py test starlingx
coverage report --omit="./venv-tox/*,./.tox/*,*tests*,*__init__.py,*newton_base*,*common*" --fail-under=30