-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathDockerfile
75 lines (61 loc) · 1.98 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FROM debian:buster AS builder
ENV LANG C.UTF-8
# to install ghcup + ghc, cabal and stack
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
build-essential \
libffi-dev \
libffi6 \
libgmp-dev \
libgmp10 \
libncurses-dev \
libncurses5 \
libtinfo5 \
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
# install cabal
ARG CABAL_VERSION=3.4.0.0
RUN ghcup install cabal -i /usr/local/bin $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 + remove profiling support
ARG GHC_VERSION=8.10.7
RUN ghcup install ghc -i /opt/ghc $GHC_VERSION && \
find /opt/ghc/lib -name "*.p_hi" -type f -delete && \
find /opt/ghc/lib -name "*_p.a" -type f -delete
FROM debian:buster
ENV LANG C.UTF-8
# common haskell + stack dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
g++ \
gcc \
git \
gnupg \
libc6-dev \
libffi-dev \
libgmp-dev \
libtinfo-dev \
make \
netbase \
xz-utils \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /opt/ghc/bin /opt/ghc/bin
COPY --from=builder /opt/ghc/lib /opt/ghc/lib
# stack should use global ghc
RUN /usr/local/bin/stack config set system-ghc --global true && \
/usr/local/bin/stack config set install-ghc --global false
# ensure any user gets GHC on the path
RUN echo 'export PATH="/opt/ghc/bin:$PATH"' >> /etc/profile.d/ghc_path.sh && \
chmod +x /etc/profile.d/ghc_path.sh
ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/ghc/bin:$PATH
CMD ["ghci"]