Skip to main content

docker-ghc Updates

GHC 8.10.6 has been released! I updated docker-ghc, and the update includes a few other changes as well.

Debian bullseye

Debian bullseye was released last week, and the debian Docker image was re-tagged this morning. I updated docker-ghc to use the new release.

GHC has different dependencies in the new release than in the previous release. Debian buster uses libffi6 while Debian bullseye uses libffi7. I would like to keep the old configuration around, so I reorganized the docker-ghc project to have different configuration per OS distribution. All of the configured image versions use bullseye, but one can still easily build buster images when necessary. See the example configurations for details.

ghcup

The ghcup project has improved significantly! When installing GHC for a docker-ghc image, I use ghcup when the target compiler is supported, and I do a manual install otherwise. ghcup now has support for many more GHC versions, and it was updated quickly to support GHC 8.10.6!

With this update to docker-ghc, all of the configured image versions use ghcup. I am keeping the manual code around in case it is ever needed again in the future. See the example configurations for details.

Example Configurations

Images are configured in the Makefile by creating a new rule that specifies the configuration for the image and calls the internal rule for building the image. For example, an image can be configured to be built using ghcup as follows:

ghc-9.2: # build GHC 9.2 image
ghc-9.2: DOCKER_TAG = 9.2
ghc-9.2: GHC_VERSION = 9.2.0.20210422
ghc-9.2: DISTRO = bullseye
ghc-9.2: build-ghcup
.PHONY: ghc-9.2

In this example, the rule is named ghc-9.2, so the image is built by running the following command:

$ make ghc-9.2

The first line associates a comment with the rule, which is used in the help output. The following three lines specify the three configuration variables that are required for using build-ghcup. The DOCKER_TAG variable specifies the Docker tag to set. Only the GHC version is used in this example, but you can use a value like 9.2-bullseye if you need to build images with different OS distributions. The GHC_VERSION variable specifies the version of GHC to install, as used in ghcup. The DISTRO variable specifies the OS distribution to use. The following line specifies that the image is built using the internal build-ghcup rule, using the configuration in the ghcup-$(DISTRO) directory. The final line is an artifact of (ab)using Make.

Alternatively, an image can be configured to be built manually as follows:

ghc-9.2: # build GHC 9.2 image
ghc-9.2: DOCKER_TAG = 9.2
ghc-9.2: GHC_URL = https://downloads.haskell.org/ghc/9.2.1-alpha2/ghc-9.2.0.20210422-x86_64-deb10-linux.tar.xz
ghc-9.2: GHC_DIR = ghc-9.2.0.20210422
ghc-9.2: CABAL_URL = https://downloads.haskell.org/~cabal/cabal-install-3.4.0.0/cabal-install-3.4.0.0-x86_64-ubuntu-16.04.tar.xz
ghc-9.2: DISTRO = bullseye
ghc-9.2: build-manual
.PHONY: ghc-9.2

Instead of specifying a GHC_VERSION variable, GHC_URL, GHC_DIR, and CABAL_URL configuration variables are used to set the path of the GHC tarball, the extracted directory name, and the path of the Cabal tarball for the desired versions. The image is built using the internal build-manual rule, using the configuration in the manual-$(DISTRO) directory.

Author

Travis Cardwell

Published

Tags