Skip to content

Instantly share code, notes, and snippets.

@bjin
Last active March 29, 2023 12:49
Show Gist options
  • Save bjin/5a180d9b841b94862dfe2d1aabf11981 to your computer and use it in GitHub Desktop.
Save bjin/5a180d9b841b94862dfe2d1aabf11981 to your computer and use it in GitHub Desktop.
stack-docker
FROM alpine:3.12
ENV GHC_VERSION=9.4.4
RUN apk add --update --no-cache shadow ca-certificates curl tar libc-dev libffi-dev zlib-dev zlib-static linux-headers git openssh xz perl bash alpine-sdk gmp-dev binutils-gold && \
update-ca-certificates
RUN (curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/stack')
RUN (curl -L https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-x86_64-alpine3_12-linux-static-int_native.tar.xz | tar xJ -C /tmp) && \
cd /tmp/ghc-${GHC_VERSION}* && \
./configure --prefix=/usr/local LD=/usr/bin/ld.gold && make install && \
rm -rf /tmp/ghc-${GHC_VERSION}*
RUN adduser -h /home/stack -D stack stack
USER stack
WORKDIR /home/stack
RUN mkdir $HOME/.stack && \
stack config set system-ghc --global true
USER root
RUN mkdir $HOME/.stack && \
stack config set system-ghc --global true
CMD ["/bin/sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment