Skip to content

Commit b0046b3

Browse files
feat : use --no-cache-dir flag to pip in dockerfiles to save space (#792)
* feat : use --no-cache-dir flag to pip in dockerfiles to save space using the "--no-cache-dir" flag in pip install, make sure downloaded packages by pip don't cache on the system. This is a best practice that makes sure to fetch from a repo instead of using a local cached one. Further, in the case of Docker Containers, by restricting caching, we can reduce image size. In terms 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 reduces a lot by don't cache pip packages. Further, more detailed information can be found at https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6 Signed-off-by: Pratik Raj <rajpratik71@gmail.com> * dont apply change to frozen images Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com> --------- Signed-off-by: Pratik Raj <rajpratik71@gmail.com> Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com> Co-authored-by: Mikael Arguedas <mikael.arguedas@gmail.com>
1 parent 64d2518 commit b0046b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM python:3
33
WORKDIR /tmp/
44

55
COPY requirements.txt .
6-
RUN pip install -r requirements.txt
6+
RUN pip install --no-cache-dir -r requirements.txt
77

88
RUN git clone \
99
-b master \

0 commit comments

Comments
 (0)