summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPratik raj <rajpratik71@gmail.com>2020-12-30 10:41:52 +0530
committerPratik raj <rajpratik71@gmail.com>2020-12-30 10:41:52 +0530
commit533c0d77decb5c86f5f06e4a8061a9042b7ce6ce (patch)
tree1485bd3f70694a82fa2a9d8e6d31fedc07a7b783
parent37cc7b1bb226e2d2840b093290b4afb5aa78ec16 (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
-rw-r--r--fcaps/docker/Dockerfile4
-rw-r--r--lenovo/docker/Dockerfile2
-rw-r--r--newton/docker/Dockerfile2
-rw-r--r--ocata/docker/Dockerfile2
-rw-r--r--ocata/vagrant/test/Dockerfile2
-rw-r--r--pike/docker/Dockerfile4
-rw-r--r--pike/vagrant/test/Dockerfile4
-rw-r--r--starlingx/docker/Dockerfile4
-rw-r--r--windriver/docker/Dockerfile4
9 files changed, 14 insertions, 14 deletions
diff --git a/fcaps/docker/Dockerfile b/fcaps/docker/Dockerfile
index 06654e95..3b252d67 100644
--- a/fcaps/docker/Dockerfile
+++ b/fcaps/docker/Dockerfile
@@ -27,8 +27,8 @@ RUN apk update && \
unzip -q -o -B multicloud-openstack-fcaps.zip && \
chmod +x /opt/fcaps/*.sh && \
rm -f multicloud-openstack-fcaps.zip && \
- pip3 install -r /opt/fcaps/requirements.txt && \
- pip3 install -r /opt/fcaps/uwsgi-requirements.txt && \
+ pip3 install --no-cache-dir -r /opt/fcaps/requirements.txt && \
+ pip3 install --no-cache-dir -r /opt/fcaps/uwsgi-requirements.txt && \
apk del wget unzip gcc make libc-dev libffi-dev openssl-dev pcre-dev && \
mkdir -p /var/log/onap/multicloud/fcaps && \
chown onap:onap /var/log/onap -R && \
diff --git a/lenovo/docker/Dockerfile b/lenovo/docker/Dockerfile
index c4489ce7..8d0a5e8e 100644
--- a/lenovo/docker/Dockerfile
+++ b/lenovo/docker/Dockerfile
@@ -41,7 +41,7 @@ RUN apt-get update && \
unzip -q -o -B multicloud-openstack-lenovo.zip && \
chmod +x /opt/lenovo/*.sh &&\
rm -f multicloud-openstack-lenovo.zip &&\
- pip install -r /opt/lenovo/requirements.txt &&\
+ pip install --no-cache-dir -r /opt/lenovo/requirements.txt &&\
apt-get --purge remove -y wget unzip gcc libssl-dev && \
apt-get -y autoremove && \
mkdir -p /var/log/onap/multicloud/openstack/lenovo && \
diff --git a/newton/docker/Dockerfile b/newton/docker/Dockerfile
index 3a7d3095..6c477b03 100644
--- a/newton/docker/Dockerfile
+++ b/newton/docker/Dockerfile
@@ -39,7 +39,7 @@ RUN apt-get update && \
unzip -q -o -B multicloud-openstack-newton.zip && \
chmod +x /opt/newton/*.sh && \
rm -f multicloud-openstack-newton.zip && \
- pip install -r /opt/newton/requirements.txt
+ pip install --no-cache-dir -r /opt/newton/requirements.txt
WORKDIR /opt/newton
CMD /bin/sh -c /opt/newton/run.sh
diff --git a/ocata/docker/Dockerfile b/ocata/docker/Dockerfile
index c4fa139a..ebf2d179 100644
--- a/ocata/docker/Dockerfile
+++ b/ocata/docker/Dockerfile
@@ -40,7 +40,7 @@ RUN apt-get update && \
wget -O /opt/multicloud-openstack-ocata.zip "https://nexus.onap.org/service/local/artifact/maven/redirect?r=staging&g=org.onap.multicloud.openstack&a=multicloud-openstack-ocata&e=zip&v=1.4.0" && \
unzip -q -o -B /opt/multicloud-openstack-ocata.zip -d /opt/ && \
rm -f /opt/multicloud-openstack-ocata.zip && \
- pip install -r /opt/ocata/requirements.txt && \
+ pip install --no-cache-dir -r /opt/ocata/requirements.txt && \
apt-get --purge remove -y wget unzip gcc libssl-dev && \
apt-get -y autoremove && \
mkdir -p /var/log/onap/multicloud/openstack/ocata && \
diff --git a/ocata/vagrant/test/Dockerfile b/ocata/vagrant/test/Dockerfile
index 10e17cae..c3bfaafc 100644
--- a/ocata/vagrant/test/Dockerfile
+++ b/ocata/vagrant/test/Dockerfile
@@ -31,7 +31,7 @@ RUN apt-get update && \
unzip -q -o -B multicloud-openstack-ocata.zip && \
chmod +x /opt/ocata/*.sh && \
rm -f multicloud-openstack-ocata.zip && \
- pip install -r /opt/ocata/requirements.txt
+ pip install --no-cache-dir -r /opt/ocata/requirements.txt
ADD extsys.py /opt/ocata/lib/share/common/msapi/extsys.py
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 && \
diff --git a/starlingx/docker/Dockerfile b/starlingx/docker/Dockerfile
index 4e635297..16b39bc7 100644
--- a/starlingx/docker/Dockerfile
+++ b/starlingx/docker/Dockerfile
@@ -40,8 +40,8 @@ RUN apk update && \
cd /opt/ && \
unzip -q -o -B /opt/multicloud-openstack-starlingx.zip -d /opt/ && \
rm -f /opt/multicloud-openstack-starlingx.zip && \
- pip3 install -r /opt/starlingx/requirements.txt && \
- pip3 install -r /opt/starlingx/uwsgi-requirements.txt && \
+ pip3 install --no-cache-dir -r /opt/starlingx/requirements.txt && \
+ pip3 install --no-cache-dir -r /opt/starlingx/uwsgi-requirements.txt && \
apk del wget unzip gcc make libc-dev libffi-dev openssl-dev pcre-dev && \
mkdir -p /var/log/onap/multicloud/openstack/starlingx && \
chown onap:onap /var/log/onap -R && \
diff --git a/windriver/docker/Dockerfile b/windriver/docker/Dockerfile
index 4bde9d50..e25bd41a 100644
--- a/windriver/docker/Dockerfile
+++ b/windriver/docker/Dockerfile
@@ -26,8 +26,8 @@ RUN apk update && \
unzip -q -o -B multicloud-openstack-windriver.zip && \
chmod +x /opt/windriver/*.sh && \
rm -f multicloud-openstack-windriver.zip && \
- pip3 install -r /opt/windriver/requirements.txt && \
- pip3 install -r /opt/windriver/uwsgi-requirements.txt && \
+ pip3 install --no-cache-dir -r /opt/windriver/requirements.txt && \
+ pip3 install --no-cache-dir -r /opt/windriver/uwsgi-requirements.txt && \
apk del wget unzip gcc make libc-dev libffi-dev openssl-dev pcre-dev && \
mkdir -p /var/log/onap/multicloud/openstack/windriver && \
chown onap:onap /var/log/onap -R && \