Skip to content

Instantly share code, notes, and snippets.

@maxsu

maxsu/DOCKERFILE Secret

Last active December 1, 2020 02:32
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 maxsu/098e896fb820b577b52214633861f5bb to your computer and use it in GitHub Desktop.
Save maxsu/098e896fb820b577b52214633861f5bb to your computer and use it in GitHub Desktop.
## Build GHC in Alpine (for freshness)
FROM alpine:3.12 as hask
ENV ghc_version=8.6.5
ENV deps="build-base dev perl tar xz \
gmp-dev libffi-dev ncurses-dev zlib-dev"
ADD https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup ghcup
ADD https://get.haskellstack.org/stable/linux-x86_64.tar.gz stack
ADD https://api.github.com/alexwl/haskell-code-explorer/tarball hce
RUN apk add --no-cache $deps \
# Setup stack and ghcup
&& tar xf stack */stack \
&& chmod +x stack ghcup \
&& ./ghcup set ghc $ghc_version \
# Setup haskell code explorer
&& tar -xf hce \
&& ./stack install hce \
--system-ghc \
--stack-yaml=stack-$ghc_version.yaml \
--ghc-options='-optl-static -split-sections'
## Then trampoline onto Ubuntu (for luxury)
FROM ubuntu:focal as hask2
ENV up=/root/.ghcup/bin
ENV PATH=$up:$PATH
ENV deps="build-essential pkg-config software-properties-common \
libffi-dev libgmp-dev libncurses-dev libssl-dev \
libtinfo5 libsodium-dev zlib1g-dev"
COPY --from=hask ghcup stack $up/*server $up/*indexer usr/bin/
RUN apt-get update && apt-get install -y $deps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment