summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPratik Raj <rajpratik71@gmail.com>2020-06-06 21:56:53 +0530
committerkrishna moorthy <krishna.moorthy6@wipro.com>2020-08-01 15:40:06 +0000
commit9b01155e3ca2626e6ca7416fbf857bcd92a8ad39 (patch)
tree81f64455c207612a60af9b179f7b701db0c9ee21
parent8699f0d40189cc35775399352aa1f35e175bdd29 (diff)
optimize size and time using "--no-cache-dir"
Using "--no-cache-dir" flag in pip install ,make sure dowloaded packages by pip don't cached on system . This is a best practise which make sure to fetch ftom repo instead of using local cached one . Further , in case of Docker Containers , by restricing caching , we can reduce image size. In term of stats , it depends upon the number of python packages multiplied by their respective size . e.g for heavy packages with a lot of dependencies it reduce a lot by don't caching pip packages. Further , more detail information can be found at https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6 Issue-ID: OPTFRA-774 Signed-off-by: Pratik Raj <rajpratik71@gmail.com> Change-Id: I40d9eb94ecea623a9ed54b50b1786b154788a17b
-rwxr-xr-xconductor/conductor/tests/functional/simulators/aafsim/Dockerfile4
-rwxr-xr-xconductor/conductor/tests/functional/simulators/aaisim/Dockerfile2
-rwxr-xr-xconductor/conductor/tests/functional/simulators/multicloudsim/Dockerfile2
-rw-r--r--conductor/docker/Dockerfile6
-rw-r--r--conductor/tox.ini2
-rw-r--r--docs/sections/installation.rst8
-rwxr-xr-xsonar.sh4
7 files changed, 14 insertions, 14 deletions
diff --git a/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile b/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile
index eb43a86..0a3ea52 100755
--- a/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile
+++ b/conductor/conductor/tests/functional/simulators/aafsim/Dockerfile
@@ -26,8 +26,8 @@ WORKDIR /opt/aafsim
ADD ./ /opt/aafsim
# Install any needed packages specified in requirements.txt
-RUN pip install web.py
-RUN pip install oslo.log
+RUN pip install --no-cache-dir web.py
+RUN pip install --no-cache-dir oslo.log
# Make port 80 available to the world outside this container
EXPOSE 8100
diff --git a/conductor/conductor/tests/functional/simulators/aaisim/Dockerfile b/conductor/conductor/tests/functional/simulators/aaisim/Dockerfile
index 9ab4213..d88a78a 100755
--- a/conductor/conductor/tests/functional/simulators/aaisim/Dockerfile
+++ b/conductor/conductor/tests/functional/simulators/aaisim/Dockerfile
@@ -26,7 +26,7 @@ WORKDIR /opt/aaisim
ADD ./ /opt/aaisim
# Install any needed packages specified in requirements.txt
-RUN pip install web.py
+RUN pip install --no-cache-dir web.py
# Make port 80 available to the world outside this container
EXPOSE 8081
diff --git a/conductor/conductor/tests/functional/simulators/multicloudsim/Dockerfile b/conductor/conductor/tests/functional/simulators/multicloudsim/Dockerfile
index aeaf2b9..19b5d04 100755
--- a/conductor/conductor/tests/functional/simulators/multicloudsim/Dockerfile
+++ b/conductor/conductor/tests/functional/simulators/multicloudsim/Dockerfile
@@ -26,7 +26,7 @@ WORKDIR /opt/multicloudsim
ADD ./ /opt/multicloudsim
# Install any needed packages specified in requirements.txt
-RUN pip install web.py
+RUN pip install --no-cache-dir web.py
# Make port 80 available to the world outside this container
EXPOSE 8082
diff --git a/conductor/docker/Dockerfile b/conductor/docker/Dockerfile
index 38afc0e..e20efda 100644
--- a/conductor/docker/Dockerfile
+++ b/conductor/docker/Dockerfile
@@ -49,9 +49,9 @@ RUN apk --update add py-setuptools && \
apk add bash vim && \
apk add nginx && \
apk add py2-pip libpq python-dev && \
- pip install --upgrade pip && \
+ pip install --no-cache-dir --upgrade pip && \
apk add --virtual build-dependencies build-base linux-headers pcre-dev libffi-dev libxslt-dev libressl-dev && \
- pip install uwsgi
+ pip install --no-cache-dir uwsgi
# Get, Install, cleanup and setup
COPY onap-has-tm/optf-has-conductor-${MVN_ARTIFACT_VERSION}.zip /tmp/optf-has.zip
@@ -59,7 +59,7 @@ RUN unzip -q -o -B /tmp/optf-has.zip -d /opt/has && rm -f /tmp/optf-has.zip
#PKG-INFO file must also exists in the conductor folder (i.e. besides and inside the of_has.egg-info folder). The zip file for distro above is missing it
RUN cp /opt/has/conductor/of_has.egg-info/PKG-INFO /opt/has/conductor
-RUN pip install -e /opt/has/conductor
+RUN pip install --no-cache-dir -e /opt/has/conductor
COPY app.wsgi /etc/nginx/conductor.wsgi
COPY api_paste.ini /usr/local/etc/conductor/api_paste.ini
diff --git a/conductor/tox.ini b/conductor/tox.ini
index a6aa070..e358564 100644
--- a/conductor/tox.ini
+++ b/conductor/tox.ini
@@ -7,7 +7,7 @@ envlist = py3,pep8
basepython=python3
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-install_command = pip install -U {opts} {packages}
+install_command = pip install --no-cache-dir -U {opts} {packages}
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=conductor/tests/unit
diff --git a/docs/sections/installation.rst b/docs/sections/installation.rst
index df7a4c2..c116b8b 100644
--- a/docs/sections/installation.rst
+++ b/docs/sections/installation.rst
@@ -223,9 +223,9 @@ Once the configuration is in place, installation is simple:
.. code:: bash
- $ pip install of-has
+ $ pip install --no-cache-dir of-has
-To upgrade or downgrade, simply re-run ``pip install`` using the
+To upgrade or downgrade, simply re-run ``pip install --no-cache-dir`` using the
appropriate ``pip`` command line options.
**NOTE**: Be sure proxy settings are in place if they're required to
@@ -251,14 +251,14 @@ directory:
Receiving objects: 100% (2291/2291), 477.59 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1422/1422), done.
$ cd conductor
- $ pip install .
+ $ pip install --no-cache-dir .
The latest source can be pulled from ONAP at any time and reinstalled:
.. code:: bash
$ git pull
- $ pip install .
+ $ pip install --no-cache-dir .
Verifying Installation
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/sonar.sh b/sonar.sh
index 566ede7..4d17c7c 100755
--- a/sonar.sh
+++ b/sonar.sh
@@ -29,8 +29,8 @@ run_tox_test()
rm -rf ./venv-tox ./.tox
virtualenv ./venv-tox
source ./venv-tox/bin/activate
- pip install --upgrade pip
- pip install --upgrade tox argparse
+ pip install --no-cache-dir --upgrade pip
+ pip install --no-cache-dir --upgrade tox argparse
pip freeze
tox -e cover
deactivate