Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROJQUAY-987 - use --no-cache-dir flag to pip in dockerfiles, to save space #529

Merged
merged 1 commit into from
Aug 26, 2020
Merged

PROJQUAY-987 - use --no-cache-dir flag to pip in dockerfiles, to save space #529

merged 1 commit into from
Aug 26, 2020

Conversation

Rajpratik71
Copy link
Contributor

@Rajpratik71 Rajpratik71 commented Aug 20, 2020

using "--no-cache-dir" flag in pip install ,make sure downloaded packages
by pip don't cached on system . This is a best practice which make sure
to fetch from repo instead of using local cached one . Further , in case
of Docker Containers , by restricting 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

Issue: https://issues.redhat.com/browse/PROJQUAY-987

@app-sre-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@kleesc
Copy link
Member

kleesc commented Aug 24, 2020

@Rajpratik71 Doesn't look like it's able to build with PIP_NO_CACHE_DIR set to yes, at least for the version of pip we're using.

using "--no-cache-dir" flag in pip install ,make sure downloaded packages
by pip don't cached on system . This is a best practice which make sure
to fetch from repo instead of using local cached one . Further , in case
of Docker Containers , by restricting 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>
@Rajpratik71 Rajpratik71 changed the title PROJQUAY-987 - Use PIP_NO_CACHE_DIR=yes for pip in Dockerfiles ENV, to save space PROJQUAY-987 - use --no-cache-dir flag to pip in dockerfiles, to save space Aug 24, 2020
@Rajpratik71
Copy link
Contributor Author

@Rajpratik71 Doesn't look like it's able to build with PIP_NO_CACHE_DIR set to yes, at least for the version of pip we're using.

yes , got it , this is because this feature is implemented in PIP v20 later but initially the system contain old version of PIP , which make it crash because it automatically loaded from Environment Variable . i.e. why i switched whole system to traditional "--no-cache-dir" flag to ignore pip caches in Docker Images to reduce download size and time

Copy link
Member

@kleesc kleesc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

3 participants