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

Change-Id: If206e41f3bac6e0b73b57e85c80fa2530ee9d4cf
Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
This commit is contained in:
Pratik Raj 2020-10-03 12:18:43 +05:30 committed by Andrey Kurilin
parent 63006885d0
commit e4dd6597c4
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@ RUN sed -i s/^deb-src.*// /etc/apt/sources.list
RUN apt-get update && apt-get install --yes sudo python3-dev python3-pip vim git-core && \
apt clean && \
pip3 install --upgrade pip setuptools && \
pip3 --no-cache-dir install --upgrade pip setuptools && \
useradd -u 65500 -m rally && \
usermod -aG sudo rally && \
echo "rally ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/00-rally-user && \