[Docker] Don't cache composer deps, remove any .git repos that creep in #16700
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.
There is a failure mode in composer where if it has a connection trying to get
a dependency tarball from the github API, it will fall-back to
downloading the entire repo for the dependency and use that... and it
will cache it outside of vendor/, using a whopping 1.5G of space
that full 1.5G is then copied into vendor/
for a total of a 1.8G vendor/ directory
vs the trimmed-down version with a 552M vendor/ directory
This is still a far cry from the proper 150M version when everything
works as it should, but it's still a vast improvement
Ideally this never happens, but it'd be great tp avoid the bloat if/when
it does..
To wit: Our ARM/Ubuntu Docker images are currently bloated because of this
issue due builds happening on an emulated ARM environment, and the resultant
performance penalties causing composer issues
All that to say, this change sets OMPOSER_CACHE_DIR to /dev/null to
avoid the caching, and then removes
vendor/*/*/.gitto remove thatneedless bloat if it occurs. It's a no-op in general practice.