Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

accursoft/haskell-cloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Usage

These examples use the sample repository.

Source-to-Image

Download S2I from GitHub, and build an image with:

s2i build --rm https://github.com/accursoft/haskell-cloud-template 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

OpenShift

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~https://github.com/accursoft/haskell-cloud-template --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.

Haskell

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.