Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Haskell Cloud

Haskell Cloud is a Source-to-Image builder for building Haskell source into a runnable Docker image. It can be used directly with s2i, or deployed on OpenShift.


These examples use the sample repository.


Download S2I from GitHub, and build an image with:

s2i build --rm accursoft/ghc haskell-cloud

The resulting image can be run with:

docker run --name haskell-cloud -d -p 8080:8080 haskell-cloud

See it in action:

curl localhost:8080


Download the CLI from your OpenShift console, and follow the instructions for logging in. Create a project (through the console or CLI) if you do not already have one, and select it with oc project.

To create the application:

oc new-app accursoft/ghc~ --name="haskell-cloud"

To see it in action, create a route from the console, or oc expose service haskell-cloud. Note that it can take a few minutes for OpenShift to begin routing traffic.

Incremental Builds

Incremental builds re-use compiled dependencies and the hackage index from the previous build.

  • s2i: Pass the --incremental flag to s2i build.
  • OpenShift: oc patch buildconfig haskell-cloud -p '{"spec":{"strategy":{"sourceStrategy":{"incremental":true}}}}'

Old packages are never removed from incremental builds, so an occasional clean build may be required to avoid image bloat.

Apply the cabal_update marker (see below) to force cabal update before incremental builds.


The application's cabal file must define an executable called server, which listens on port 8080. This is provided as the PORT environment variable and as a command line argument.

Markers and Hooks

Markers and hooks can be created in .s2i/ to modify the build process.