Statically linked distributions of GHC for building binaries in Docker.
10K+
See README.md at https://github.com/fossas/haskell-static-alpine, reproduced below.
haskell-static-alpine is an Alpine-based Docker image that contains GHC and cabal, for building static Haskell executables.
Normally, Haskell binaries are dynamically linked, and require glibc and gmp at runtime. These libraries are unavailable in some environments, such as Alpine Docker images.
(Note that even if you specify --enable-executable-static, GHC will still dynamically link against glibc, much like cgo.)
If you deploy Haskell binaries in these environments, you need a fully statically linked executable. You can construct such an executable using this Docker image.
This Docker image uses the Alpine distribution of GHC, which will statically link generated executables against musl when provided --enable-executable-static.
This image is automatically published on Docker Hub. To pull it, run:
docker pull fossa/haskell-static-alpine:$VERSION
Supported versions are:
ghc-8.8.2ghc-8.10.3ghc-8.10.4You should use this container as a base image for your own build containers.
Within a container, run:
cabal build --enable-executable-static
This will build a statically linked Haskell binary. Make sure to strip the binary afterwards to reduce size.
Content type
Image
Digest
sha256:eb82a7333…
Size
422.2 MB
Last updated
11 months ago
docker pull fossa/haskell-static-alpine:ghc-9.8.4