Simple base image based on: https://vadosware.io/post/static-binaries-for-haskell-a-convoluted-approach/ https://www.reddit.com/r/haskell/comments/5lk33p/struggling_building_a_static_binary_for_aws/
- Adding
ld-options: -staticto your cabal file. - Mounting the project directory.
- Running
stack clean; stack install --split-objs --ghc-options="-fPIC"(Using stack, defalut binary path is$HOME/.local/bin). - You can compress a static binary using upx (installed).