system-extra-0.1.0: A bunch of system utilities used by other projects

Safe HaskellSafe
LanguageHaskell2010

System.Build

Description

Provide high-level functions to build Haskell-project using some docker image

Synopsis

Documentation

data BuildArgs Source #

Arguments passed to stack when building desired target

Constructors

SimpleTarget String

A simply named target for stack, assumes component is unique in all current packages. See https://docs.haskellstack.org/en/stable/build_command/#target-syntax.

FullTarget String String

A fully named target for stack to build. Assumes component is an executable type.

GHCOption String

Pass arguments to GHC

MoreArgs BuildArgs BuildArgs

Compose arguments

NoArgs

Neutral element for BuildArgs

stackInDocker :: ImageName -> FilePath -> BuildArgs -> IO FilePath Source #

Build a Haskell project using some docker image.

In order to maximize reuse, this process creates in the current directory a file called `.cidfile` which contains the id of the latest container that ran the build. When this file exists, the next run will reuse the volumes of the previous run which means built dependencies will normally be available.

The built target, which is assumed to be a binary executable, is then extracted from the container and copied locally in a file named after asBinaryName.

TODO: run with current user in the container or reuse stack's docker capabilities