git source type bloats images
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
kolla |
Invalid
|
Wishlist
|
Unassigned |
Bug Description
When building source type images from git locations, the '.git' directory from the repo is included in the tarball which bloats the size of the images.
E.g. for nova-base, the image built from tarballs is ~846.1 MB, whereas the same from git is 1.134 GB.
This could be as simple as excluding the .git directory when creating the tarball, however pbr requires this to install the package.
Another solution is to use COPY rather than ADD to skip extracting the tarball into the image, so that it can be extracted, installed, and then removed as part of a single layer during build. This is also not great though as the .git dir does not compress well in a lot of cases.
A solution I've tested that works well is to use 'python setup.py sdist' to create the tarball that gets ADDed to the image. With this, the size of an image created from a git repo is almost identical to that of the tarball build type.
description: | updated |
Changed in kolla: | |
status: | Triaged → In Progress |
importance: | Low → Wishlist |
assignee: | nobody → Paul Bourke (pauldbourke) |
Changed in kolla: | |
status: | In Progress → Triaged |
assignee: | Paul Bourke (pauldbourke) → nobody |
Why not just run python setup.py sdist on the host prior to ADD and ADD the source distribution in the container rather then a tarball of the git repository? I think this would work for any type of URI. It does require host processing when building images (which I think the workaround you suggested already does) but would remove git from the base images entirely which would be another win.
Regards
-steve