Skip to content

Instantly share code, notes, and snippets.

@lorenzo
Created April 30, 2018 08:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzo/facbd84295f14337aae8f41745dee821 to your computer and use it in GitHub Desktop.
Save lorenzo/facbd84295f14337aae8f41745dee821 to your computer and use it in GitHub Desktop.
Fast multi-stage docker builds for haskell
FROM fpco/stack-build:lts-11.7
RUN stack setup --resolver=lts-10.3
ONBUILD COPY ./stack.yaml ./package.yaml ./
ONBUILD RUN stack build --only-dependencies
FROM base-haskell:lts-11.7 AS builder
# Copy all local files and build the app
COPY . .
RUN stack install
FROM debian:stretch-slim AS distro
ENV LC_ALL=C.UTF-8
# Copy the executable from the builder stage
COPY --from=builder /root/.local/bin/hadolint /bin/
CMD ["/bin/hadolint", "-"]
#!/bin/bash
docker build -f base.dockerfile -t base-haskell:lts-11.7 .
# docker-build-cacher needs some env vars to populate the cache
export APP_NAME=hadolint
export GIT_BRANCH=master
export DOCKER_TAG=hadolint:latest
export DOCKERFILE=Dockerfile
docker-build-cacher build
docker-build-cacher cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment