Skip to content
GitLab
    • Why GitLab
    • Pricing
    • Contact Sales
    • Explore
  • Why GitLab
  • Pricing
  • Contact Sales
  • Explore
  • Sign in
  • Get free trial
  • GitLab Pages examplesGitLab Pages examples
  • hakyllhakyll
  • Issues
  • #1

Create docker image to speed up initial build

As mentioned in this @axil’s comment, a custom docker image could speed up the initial build.

The problem is a hakyll site is a full fledged application with its own dependencies (hakyll is only one of them). We could have something like

FROM haskell:7.10.3
RUN stack install hakyll

which would install hakyll globally, but then we would have no guarantee that the installed hakyll version matches the version specified in the site dependencies. (Note that the same thing happens with the Haskell version but it is not that severe because Haskell updates less frequently and individual Haskell versions are usually mostly compatible.)

Another problem is with caching additional dependencies, other than hakyll. Stack caches the already built libraries in something like $STACK_ROOT/precompiled/x86_64-linux/ghc-7.10.3/1.22.5.0 (where $STACK_ROOT is $HOME/.stack by default). If we install, for example, gd package for creating thumbnails, the built library will be stored into the directory. Between the CI builds, we are only able to cache the files inside project directory, though – which is why we currently have the $STACK_ROOT set to be inside the project directory.

We can create a default Docker package with only hakyll installed, but the main reason for using hakyll is its customizability and having to choose between

  • longer wait on first build, subsequent builds are cached (current state)
  • fast first build, fast subsequent builds if you did not use any additional libraries, slow subsequent builds if you did (default Docker package)
  • every build is fast but you have to roll your own docker image (kinda beats the whole purpose of these templates)

I would choose the first one.

Assignee
Assign to
Time tracking