From 7411cc0a4d6aab399f17fe9be78010176e1e4529 Mon Sep 17 00:00:00 2001 From: Pratik raj Date: Thu, 30 Jul 2020 10:49:38 +0530 Subject: [PATCH] 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 Signed-off-by: Pratik Raj --- examples/keras/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/keras/Dockerfile b/examples/keras/Dockerfile index e84b557..58541b3 100644 --- a/examples/keras/Dockerfile +++ b/examples/keras/Dockerfile @@ -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