Reduce the size of the layer for the Rails application
With the work done in !12 (merged) and a few follow-ups, the size of our main image is about 300MB on top of the base GitLab image.
The bulk of that improvement is #5 (closed): loading the Rails application from a pre-generated tarball instead of making it a full repository. But the corresponding layer (for Dockerfile ADD
command) weighs 137MB whereas our diff from GitLab 12.3.9 to Heptapod 0.13.0rc1 is about 300K only. That means it should be possible to gain another 130MB with little effort.
Some ideas:
- Have the Dockerfile
ADD
be smarter and not touch unchanged files (could be just a matter of metadata) - Instead of a full tarball, generate a diff and apply it with
patch
during the build - Pre-generate a "delta tarball", with only those files that actually differ between GitLab upstream and Heptapod
Note that at some point in the future, we'll rebuild everything from the base OS image (currently Ubuntu 16.04) or from new "cloud native" GitLab images. This could happen in a few months, and that will make current optimization efforts obsolete, Gaining 130MB with at most a few hours of work seems right in that perspective.