@@ -2,6 +2,7 @@ FROM debian:buster AS builder
2
2
3
3
ENV LANG C.UTF-8
4
4
5
+ # prereqs for ghcup + installing ghc, cabal + stack
5
6
RUN apt-get update && \
6
7
apt-get install -y --no-install-recommends \
7
8
ca-certificates \
@@ -16,24 +17,41 @@ RUN apt-get update && \
16
17
curl && \
17
18
rm -rf /var/lib/apt/lists/*
18
19
20
+ # install ghcup
19
21
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
20
24
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
24
26
ARG CABAL_VERSION=3.4.0.0
27
+ RUN ghcup install cabal -i /usr/local/bin $CABAL_VERSION
25
28
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
28
32
33
+ # install GHC into /opt/ghc
29
34
ARG GHC_VERSION=8.10.6
35
+ RUN ghcup install ghc -i /opt/ghc $GHC_VERSION
30
36
31
- RUN ./ghcup install ghc $GHC_VERSION && \
32
- ./ghcup set ghc $GHC_VERSION
37
+ FROM debian:buster
33
38
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/*
35
50
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
38
53
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