Skip to content

Instantly share code, notes, and snippets.

@docteurklein
Created April 2, 2019 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save docteurklein/bc17f4a967ee961652698075f0ee1ec8 to your computer and use it in GitHub Desktop.
Save docteurklein/bc17f4a967ee961652698075f0ee1ec8 to your computer and use it in GitHub Desktop.
FROM alpine:edge as build
RUN apk add --no-cache ghc musl-dev
RUN wget https://github.com/commercialhaskell/stack/releases/download/v1.9.0.1/stack-1.9.0.1-linux-x86_64-static.tar.gz -O - \
| tar -Oxzf - stack-1.9.0.1-linux-x86_64-static/stack > /usr/bin/stack
RUN chmod +x /usr/bin/stack
WORKDIR /usr/src/app
RUN adduser -D -u 1000 build
RUN chown build:build .
USER build
RUN stack config set system-ghc --global true
COPY --chown=build . .
RUN stack build --ghc-options='-optl-static -optl-pthread' --force-dirty
FROM scratch
USER 1000
COPY --from=build /usr/src/app/.stack-work/install/x86_64-linux/lts-12.12/8.4.3/bin/test-exe /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/test-exe"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment