diff options
author | Pratik raj <rajpratik71@gmail.com> | 2020-12-30 10:41:52 +0530 |
---|---|---|
committer | Pratik raj <rajpratik71@gmail.com> | 2020-12-30 10:41:52 +0530 |
commit | 533c0d77decb5c86f5f06e4a8061a9042b7ce6ce (patch) | |
tree | 1485bd3f70694a82fa2a9d8e6d31fedc07a7b783 /pike | |
parent | 37cc7b1bb226e2d2840b093290b4afb5aa78ec16 (diff) |
[docker] use `--no-cache-dir` flag to `pip` in dockerfiles to save spacehonolulu
using "--no-cache-dir" flag in pip install ,make sure downloaded packages
by pip don't cached on system . This is a best practice which make sure
to fetch from repo instead of using local cached one . Further , in case
of Docker Containers , by restricting 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: MULTICLOUD-1279
Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
Change-Id: If01ac9167727423f65788bdf6abfd8ee0e1546cc
Diffstat (limited to 'pike')
-rw-r--r-- | pike/docker/Dockerfile | 4 | ||||
-rw-r--r-- | pike/vagrant/test/Dockerfile | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/pike/docker/Dockerfile b/pike/docker/Dockerfile index af7ded77..8e29acc3 100644 --- a/pike/docker/Dockerfile +++ b/pike/docker/Dockerfile @@ -40,8 +40,8 @@ RUN apt-get update && \ cd /opt/ && \ unzip -q -o -B /opt/multicloud-openstack-pike.zip -d /opt/ && \ rm -f /opt/multicloud-openstack-pike.zip && \ - pip3 install -r /opt/pike/requirements.txt && \ - pip3 install -r /opt/pike/uwsgi-requirements.txt && \ + pip3 install --no-cache-dir -r /opt/pike/requirements.txt && \ + pip3 install --no-cache-dir -r /opt/pike/uwsgi-requirements.txt && \ apt-get --purge remove -y wget unzip gcc libssl-dev && \ mkdir -p /var/log/onap/multicloud/openstack/pike && \ chown onap:onap /var/log/onap -R && \ diff --git a/pike/vagrant/test/Dockerfile b/pike/vagrant/test/Dockerfile index 292cb26e..a1154dc0 100644 --- a/pike/vagrant/test/Dockerfile +++ b/pike/vagrant/test/Dockerfile @@ -39,8 +39,8 @@ RUN apt-get update && \ cd /opt/ && \ unzip -q -o -B /opt/multicloud-openstack-pike.zip -d /opt/ && \ rm -f /opt/multicloud-openstack-pike.zip && \ - pip3 install -r /opt/pike/requirements.txt && \ - pip3 install -r /opt/pike/uwsgi-requirements.txt && \ + pip3 install --no-cache-dir -r /opt/pike/requirements.txt && \ + pip3 install --no-cache-dir -r /opt/pike/uwsgi-requirements.txt && \ apt-get --purge remove -y wget unzip gcc libssl-dev && \ mkdir -p /var/log/onap/multicloud/openstack/pike && \ chown onap:onap /var/log/onap -R && \ |