Created
April 30, 2018 08:42
-
-
Save lorenzo/facbd84295f14337aae8f41745dee821 to your computer and use it in GitHub Desktop.
Fast multi-stage docker builds for haskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", "-"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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