git source type bloats images

Bug #1657109 reported by Paul Bourke on 2017-01-17
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kolla
Wishlist
Paul Bourke

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
Steven Dake (sdake) wrote :

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

Changed in kolla:
status: New → Triaged
importance: Undecided → Low
Changed in kolla:
status: Triaged → In Progress
importance: Low → Wishlist
assignee: nobody → Paul Bourke (pauldbourke)

Change abandoned by Paul Bourke (pbourke) (<email address hidden>) on branch: master
Review: https://review.openstack.org/421252

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers