Commit a7a3cb1b authored by Christopher League's avatar Christopher League
Browse files

Custom docker image via nix for gitlab CI

parent 007c77e9
Pipeline #987 failed with stage
in 21 seconds
if type lorri &>/dev/null; then
echo "direnv: using lorri"
eval "$(lorri direnv)"
else
# fall back to using direnv's builtin nix support
# to prevent bootstrapping problems.
use nix
fi
image: haskell:8.8.4 image: bookme-ci:20201103c
before_script:
- mkdir -p /cache/root-stack
- ln -s /cache/root-stack /root/.stack
build: build:
script: script:
- stack test - cabal test
cache:
paths:
- .stack-work
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
let
# Extract all dependencies from a Haskell package
mkDerivation = d: {
allDeps = d.libraryHaskellDepends ++ d.executableHaskellDepends
++ d.testHaskellDepends;
};
# Use callPackage to gather dependencies for bookme
bookme = haskellPackages.callPackage ./bookme.nix { inherit mkDerivation; };
# Build custom GHC with those dependencies
bookmeGHC = haskellPackages.ghcWithPackages (_: bookme.allDeps);
in dockerTools.buildLayeredImage {
name = "bookme-ci";
tag = "20201103c";
created = "now";
# Create /tmp in final layer, cabal build needs it.
extraCommands = ''
mkdir -p tmp
'';
contents = buildEnv {
name = "bookme-ci";
# Cabal build references at least 'ar' from binutils, and 'wget'.
paths = [
bash
binutils
coreutils
wget
cabal-install
haskellPackages.hpack
bookmeGHC
];
};
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment