Skip to content

Commit 6c31aab

Browse files
committed
Update with tips from hasufell
1 parent 93863bf commit 6c31aab

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

8.10/ghcup/Dockerfile

+29-11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FROM debian:buster AS builder
22

33
ENV LANG C.UTF-8
44

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

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

21-
RUN curl -fSL https://downloads.haskell.org/~ghcup/$GHCUP_VERSION/x86_64-linux-ghcup-$GHCUP_VERSION -o ghcup && \
22-
chmod +x ghcup
23-
25+
# install cabal
2426
ARG CABAL_VERSION=3.4.0.0
27+
RUN ghcup install cabal -i /usr/local/bin $CABAL_VERSION
2528

26-
RUN ./ghcup install cabal $CABAL_VERSION && \
27-
./ghcup set cabal $CABAL_VERSION
29+
# install stack
30+
ARG STACK_VERSION=2.7.3
31+
RUN ghcup install stack -i /usr/local/bin $STACK_VERSION
2832

33+
# install GHC into /opt/ghc
2934
ARG GHC_VERSION=8.10.6
35+
RUN ghcup install ghc -i /opt/ghc $GHC_VERSION
3036

31-
RUN ./ghcup install ghc $GHC_VERSION && \
32-
./ghcup set ghc $GHC_VERSION
37+
FROM debian:buster
3338

34-
ARG STACK_VERSION=2.7.3
39+
ENV LANG C.UTF-8
40+
41+
# prereqs just for using ghc, cabal + stack
42+
# more would be added, main point is it will be slightly different
43+
# than the builder deps
44+
RUN apt-get update && \
45+
apt-get install -y --no-install-recommends \
46+
libgmp-dev \
47+
libgmp10 \
48+
build-essential && \
49+
rm -rf /var/lib/apt/lists/*
3550

36-
RUN ./ghcup install stack $STACK_VERSION && \
37-
./ghcup set stack $STACK_VERSION
51+
COPY --from=builder /usr/local/bin /usr/local/bin
52+
COPY --from=builder /opt/ghc /opt/ghc
3853

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

0 commit comments

Comments
 (0)