@lsmor good catch, yeah stack was bootstrapping GHC, so by reusing the one from the source image I have this:
root@55fd0c396c4e:~/.stack# du -sh ~/.stack/* | sort -hr
1.8G /root/.stack/pantry
676M /root/.stack/snapshots
47M /root/.stack/setup-exe-cache
232K /root/.stack/stack.sqlite3
120K /root/.stack/global-project
52K /root/.stack/setup-exe-src
4.0K /root/.stack/config.yaml
0 /root/.stack/stack.sqlite3.pantry-write-lock
So pantry
is the big driver and it is a pitty that cannot be erased. This is the list of dependecies that total those 676M in snapshots
:
- aeson
- ansi-terminal
- base
- bytestring
- containers
- either
- generic-deriving
- githash
- katip
- lens
- monad-loops
- mtl
- optparse-simple
- pretty-simple
- pqueue
- random
- safe
- servant
- servant-server
- servant-websockets
- stm
- stm-actor
- transformers
- ulid
- text
- wai
- wai-extra
- wai-cors
- warp
- QuickCheck
- genvalidity-hspec
- sydtest
- sydtest-discover
So it is “big” but pretty normal for a web sever with websockets, some logging, and testing. It doesn’t even have the DB libraries that I plan to add.
My statically compiled executable is just a mere 40Mb so I think there should be room for more trimming but I don’t know where.
So TL;DR would be:
- The current docker image weights 6.46Gb of which:
- 3.11 Gb come from the haskell:9.4.7 image
- 1.8 Gb come from the pantry
- 676 Mb are compiled dependencies
So I am going to try the haskell:9.4.7-slim
and see how it goes, but I have no idea about how to reduce pantry or the compiled dependencies, so any ideas would be helpful.