How do you trim stack compilation artifacts

Yes I think this is what I need but since it is for a CD/CI system I cannot manually specify all transitive dependencies. This will be ideal but:

  1. Given the dependencies in a package.yaml can I get the final list of all transitive dependencies?
  2. Will this approach default to query Hackage if a package cannot be found in the prepared package set? I’m thinking about having this builder created once a week for instance. If a developer adds a new dependency I want the builder to download and compile that single package on every build until the builder image catches up with the current state of the package.yaml.

On listing all dependencies, does stack ls dependencies help - see ls command - The Haskell Tool Stack.

If a package version is not in the specified package index, I think the situation is the same as when Hackage is the package index. That is, you could either (a) update the package index to include the package version or (b) specify where the package version is to be found. See Snapshot and package location - The Haskell Tool Stack. I think (but I am not sure) that when you do the latter, Stack’s Pantry database is updated to include information about the package version.

Oh, apologies, the image is 9.21GB when checking docker images, it’s 1.83GB when compressed in our registry (so what will be downloaded)
I did find a /home/stackage/.stack folder that we don’t use, where a pre-installed older GHC resides, so we’ll be removing that one from now on too (that’s another 2,4GB, I hope)

EDIT: Almost, now it’s 7.7GB (1,5GB in registry)