Skip to content

Commit

Permalink
Update with tips from hasufell
Browse files Browse the repository at this point in the history
  • Loading branch information
AlistairB committed Aug 22, 2021
1 parent 93863bf commit 6c31aab
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions 8.10/ghcup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM debian:buster AS builder

ENV LANG C.UTF-8

# prereqs for ghcup + installing ghc, cabal + stack
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
Expand All @@ -16,24 +17,41 @@ RUN apt-get update && \
curl && \
rm -rf /var/lib/apt/lists/*

# install ghcup
ARG GHCUP_VERSION=0.1.16.2
RUN curl --proto '=https' --tlsv1.2 -sSf https://downloads.haskell.org/~ghcup/$GHCUP_VERSION/x86_64-linux-ghcup-$GHCUP_VERSION > /usr/bin/ghcup && \
chmod +x /usr/bin/ghcup

RUN curl -fSL https://downloads.haskell.org/~ghcup/$GHCUP_VERSION/x86_64-linux-ghcup-$GHCUP_VERSION -o ghcup && \
chmod +x ghcup

# install cabal
ARG CABAL_VERSION=3.4.0.0
RUN ghcup install cabal -i /usr/local/bin $CABAL_VERSION

RUN ./ghcup install cabal $CABAL_VERSION && \
./ghcup set cabal $CABAL_VERSION
# install stack
ARG STACK_VERSION=2.7.3
RUN ghcup install stack -i /usr/local/bin $STACK_VERSION

# install GHC into /opt/ghc
ARG GHC_VERSION=8.10.6
RUN ghcup install ghc -i /opt/ghc $GHC_VERSION

RUN ./ghcup install ghc $GHC_VERSION && \
./ghcup set ghc $GHC_VERSION
FROM debian:buster

ARG STACK_VERSION=2.7.3
ENV LANG C.UTF-8

# prereqs just for using ghc, cabal + stack
# more would be added, main point is it will be slightly different
# than the builder deps
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libgmp-dev \
libgmp10 \
build-essential && \
rm -rf /var/lib/apt/lists/*

RUN ./ghcup install stack $STACK_VERSION && \
./ghcup set stack $STACK_VERSION
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /opt/ghc /opt/ghc

RUN cp -H /root/.ghcup/bin/* /usr/local/bin
# Adjust PATH
RUN echo 'export PATH="/opt/ghc/bin:$PATH"' >> /etc/profile.d/ghcup_path.sh && \
chmod +x /etc/profile.d/ghcup_path.sh
ENV PATH="/opt/ghc/bin:$PATH"

0 comments on commit 6c31aab

Please sign in to comment.