-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[CI] Disable pip cache when creating Docker images #8575
Conversation
* This is a good practice to save storage space in the Docker images being created * Also sort pip package lists alphabetically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @leandron ! just one question for you
@@ -23,6 +23,9 @@ FROM ubuntu:18.04 | |||
RUN apt-get update --fix-missing | |||
RUN apt-get install -y ca-certificates gnupg2 | |||
|
|||
# Globally disable pip cache | |||
RUN pip config set global.cache-dir false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it global.no-cache-dir
or global.cache-dir
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it locally and it seems to work to set the global config and preventing the cache to be created.
When using it in an individual pip install —no-cache-dir foo
it seems to be the way to disable in one instance, but I decided not going this way, because there is always a new pip install in those scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @leandron!
* The fix to disable cache needs to run after pip is installed * This is quick follow up fix after #8575
* This is a good practice to save storage space in the Docker images being created * Also sort pip package lists alphabetically
* The fix to disable cache needs to run after pip is installed * This is quick follow up fix after apache#8575
* This is a good practice to save storage space in the Docker images being created * Also sort pip package lists alphabetically
* The fix to disable cache needs to run after pip is installed * This is quick follow up fix after apache#8575
Disable pip cache when creating Docker images:
docker/install/*.sh
script, we re keeping a copy of it in/root/.cache/pip/*
In summary, this saves around 700Mb on the ci_cpu image, and 1.6Gb on the ci_gpu image.
cc @tqchen @areusch @mbrookhart @Mousius for reviews