Reduce docker image size #61
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@commit111 and @lionello reported that the docker image size for the docs chatbot was over 3GB on June 27. Unfortunately, we had not had a successful image build since May 22, so many changes have been made in that timeframe. Something in abbcd8a...c42f4cb inflated the image size from ~1.5GB to 3GB.
Looking into the two images with
dive
, I discovered that it there was a new 2.7GBnvidia
package in the larger June 27 image which wasn't present in the smaller May 22 image.Looking at the
compose.yaml
file, we do not specify gpu reservation, so the pytorch workloads are certainly running on cpu, and we shouldn't need any nvidia packages. Pytorch offers pre-built cpu-only wheels, and that would remove the need to download the unused nvidia package. This pre-built wheel is only available for x86, which is fine in production, since it looks like we are already deploying to x86, but since we are developing on aarch macs, we need to specify the platform in the compose file to prevent docker from building for the local architecture.While we're at it, i'm removing any options to run on cpu, since we are definitely always running on cpu already.
Here's the
dive
output for the 3GB June 27 image:When I build locally, I get an image that is
~1.5GB
: