Alpine Linux Haskell build environment for creating static binaries.
1.2K
Alpine Linux based Haskell build environment for static binaries with musl.
Image is based on the examples from the FP Complete Haskell static compilation blog post https://www.fpcomplete.com/blog/2016/10/static-compilation-with-stack .
From your project directory run:
docker run --rm -v $(pwd):/usr/src/build -v ${HOME}/.stack:/root/.stack -w /usr/src/build -it q4uw/haskell_build_env
This will:
stack home in the container to make use of artifact cachingTo statically compile a binary inside the containers project root:
stack install --local-bin-path /usr/src/build/dist --ghc-options '-optl-static -fPIC -optc-Os'
This above command will place the binary in the ${PROJECT_ROOT}/dist directory.
You can further compress the binary which significantly reduces the size using UPX.
upx --best --ultra-brute dist/${BINARY_NAME}
Content type
Image
Digest
Size
283 MB
Last updated
almost 10 years ago
docker pull q4uw/haskell_build_env