Skip to content

Commit

Permalink
optimize size and time using "--no-cache-dir"
Browse files Browse the repository at this point in the history
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

Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
  • Loading branch information
Rajpratik71 committed Nov 4, 2020
1 parent 7ade4c1 commit 7411cc0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/keras/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ RUN cd /usr/local/bin && \
ln -s /usr/bin/pip3 pip && \
pip install --upgrade pip setuptools

RUN pip install numpy==1.16.5 tensorflow-gpu==1.15.0 contextlib2==0.6.0 tqdm==4.36.1
RUN pip install tensorflow-datasets==1.2.0
RUN pip install --no-cache-dir numpy==1.16.5 tensorflow-gpu==1.15.0 contextlib2==0.6.0 tqdm==4.36.1
RUN pip install --no-cache-dir tensorflow-datasets==1.2.0

0 comments on commit 7411cc0

Please sign in to comment.