Skip to content

Latest commit

 

History

History
74 lines (58 loc) · 3.87 KB

README.md

File metadata and controls

74 lines (58 loc) · 3.87 KB

alpine-haskell-stack

Build

Docker images that are used to build static binary for Haskell projects.

The images here are used to build the static binary for the Haskell's stack build tool.

Note on Docker image generation

  • In this specific case, we are not using the official musl based ghc binaries supplied by downloads.haskell.org as it result in segmentation fault error when it was used to try and build the stack codebase.
  • Instead we build musl based GHC using Musl infrastructure of nixpkgs.
  • Note that we have to pass the appropriate ~/.stack/config.yaml with proper location of include headers and library files to make the build working.

If you have to update the image for newer GHC, you have to update these things:

  • The nixpkgs commit which has the specific GHC you want. Update the ghc-musl.nix with the appropriate commit.
  • Optionally, you can update the SHA of the base alpine image in the ghc-musl.nix file. It's optional, but good to have latest stable alpine image as the base image.
  • Update the justfile with the new GHC tag.
  • Update the stack version in the Dockerfile.
  • Create a PR to this repository. Once it's merged, create a tag and it will push the image to ghcr.io

For upgrading the base alpine images, these are the steps:

  • Get alpine image's SHA digest from dockerhub and replace it in ghc-musl.nix's imageDigest.
  • Upgrade the sha256 based on the CI error message or use skopeo to calcuate the hash.

Building images

We use just tool to simplify the building process. To build image do this:

just build-nix-image
just load-nix-image
just build-image

Testing image

just test-image
docker run --tty --interactive fpco/alpine-haskell-stack:9.2.7 sh
/ # ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.7
/ # stack --version
Version 2.9.3, Git revision 6cf638947a863f49857f9cfbf72a38a48b183e7e x86_64 hpack-0.35.1

Available images in DockerHub

Recent images are built using Github actions and uploaded to github container registry.