haskell / docker-haskell

MIT License
63 stars 37 forks source link

Move the stack args to just before they are needed #39

Closed AlistairB closed 3 years ago

AlistairB commented 3 years ago

This increases layer cacheability so that new stack versions will not invalidate the ghc / cabal install layer. As noted by @yosifkit https://github.com/docker-library/official-images/pull/10140#issuecomment-837364923

You could maximise layer caching further by moving the ghc / stack required packages ie. g++ to the initial apt-get install, which would mean new cabal versions would not invalidate these packages from being installed (or from the user's perspective, the invalidated layers they need to redownload are smaller). My inclination would be to do this change as well, or perhaps the current logical grouping has value? Any thoughts @psftw ?

EDIT: Hmm investigating the failure.. ok seems to have been a flaky gpg issue, or a caching issue. Rerunning fixed it.

psftw commented 3 years ago

Thanks again. This is a solid improvement, and your suggestion to optimize the apt bits further is also legit. I like the change more for a different reason: it makes the Dockerfile clearer about which packages came from which repositories. Anything NOT from haskell.org repos could be put in the first install. Happy to take another look if you do it, otherwise I'm good with this as-is if not. :beers:

AlistairB commented 3 years ago

Sounds good :) I've made the additional change. I probably wouldn't worry about doing a release for this change btw. Just wait until something gets bumped and then do a release.

AlistairB commented 3 years ago

Good call! Updated.