Comment 0 for bug 1657109

Revision history for this message
Paul Bourke (pauldbourke) wrote :

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.