Skip to content

use --no-cache-dir flag to pip in dockerfiles to save space#371

Open
rajpratik71 wants to merge 1 commit into
redhat-openshift-ecosystem:masterfrom
rajpratik71:optimization/pip-no-cache-dir
Open

use --no-cache-dir flag to pip in dockerfiles to save space#371
rajpratik71 wants to merge 1 commit into
redhat-openshift-ecosystem:masterfrom
rajpratik71:optimization/pip-no-cache-dir

Conversation

@rajpratik71

Copy link
Copy Markdown

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

Comment thread upstream/roles/install_iib/templates/Dockerfile-workers.j2 Outdated
@rajpratik71
rajpratik71 requested a review from lslebodn August 11, 2022 05:52
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>
@rajpratik71
rajpratik71 force-pushed the optimization/pip-no-cache-dir branch from 4c7ea4a to 1427848 Compare August 11, 2022 07:59
@lslebodn

lslebodn commented Sep 8, 2022

Copy link
Copy Markdown

@nmars bump for review

@lslebodn

lslebodn commented Sep 8, 2022

Copy link
Copy Markdown

@mvalarh bump for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants