-
Notifications
You must be signed in to change notification settings - Fork 38
/
Dockerfile
120 lines (110 loc) · 4.66 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
FROM buildpack-deps:buster
ENV LANG=C.UTF-8
# additional haskell specific deps
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libnuma-dev \
libtinfo-dev && \
rm -rf /var/lib/apt/lists/*
ARG STACK=2.15.5
ARG STACK_RELEASE_KEY=C5705533DA4F78D8664B5DC0575159689BEFB442
RUN set -eux; \
cd /tmp; \
ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)"; \
STACK_URL="https://github.com/commercialhaskell/stack/releases/download/v${STACK}/stack-${STACK}-linux-$ARCH.tar.gz"; \
# sha256 from https://github.com/commercialhaskell/stack/releases/download/v${STACK}/stack-${STACK}-linux-$ARCH.tar.gz.sha256
case "$ARCH" in \
'aarch64') \
STACK_SHA256='52cd9d9c2ee4dbf2841bba856f5fca15fbf6ba23fced7256aa3f7c8b76381c91'; \
;; \
'x86_64') \
STACK_SHA256='d55f8554932aad23f7b1198e0d5ebe332073d73fe60e3f324d0b315c156d8c43'; \
;; \
*) echo >&2 "error: unsupported architecture '$ARCH'" ; exit 1 ;; \
esac; \
curl -sSL "$STACK_URL" -o stack.tar.gz; \
echo "$STACK_SHA256 stack.tar.gz" | sha256sum --strict --check; \
\
curl -sSL "$STACK_URL.asc" -o stack.tar.gz.asc; \
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
gpg --batch --keyserver keyserver.ubuntu.com --receive-keys "$STACK_RELEASE_KEY"; \
gpg --batch --verify stack.tar.gz.asc stack.tar.gz; \
gpgconf --kill all; \
\
tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 "stack-$STACK-linux-$ARCH/stack"; \
stack config set system-ghc --global true; \
stack config set install-ghc --global false; \
\
rm -rf /tmp/*; \
\
stack --version;
ARG CABAL_INSTALL=3.8.1.0
ARG CABAL_INSTALL_RELEASE_KEY=E9EC5616017C3EE26B33468CCE1ED8AE0B011D8C
RUN set -eux; \
cd /tmp; \
ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)"; \
CABAL_INSTALL_TAR="cabal-install-$CABAL_INSTALL-$ARCH-linux-deb10.tar.xz"; \
CABAL_INSTALL_URL="https://downloads.haskell.org/~cabal/cabal-install-$CABAL_INSTALL/$CABAL_INSTALL_TAR"; \
CABAL_INSTALL_SHA256SUMS_URL="https://downloads.haskell.org/~cabal/cabal-install-$CABAL_INSTALL/SHA256SUMS"; \
# sha256 from https://downloads.haskell.org/~cabal/cabal-install-$CABAL_INSTALL/SHA256SUMS
case "$ARCH" in \
'aarch64') \
CABAL_INSTALL_SHA256='c7fa9029f2f829432dd9dcf764e58605fbb7431db79234feb3e46684a9b37214'; \
;; \
'x86_64') \
CABAL_INSTALL_SHA256='c71a1a46fd42d235bb86be968660815c24950e5da2d1ff4640da025ab520424b'; \
;; \
*) echo >&2 "error: unsupported architecture '$ARCH'"; exit 1 ;; \
esac; \
curl -fSL "$CABAL_INSTALL_URL" -o cabal-install.tar.gz; \
echo "$CABAL_INSTALL_SHA256 cabal-install.tar.gz" | sha256sum --strict --check; \
\
curl -sSLO "$CABAL_INSTALL_SHA256SUMS_URL"; \
curl -sSLO "$CABAL_INSTALL_SHA256SUMS_URL.sig"; \
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
gpg --batch --keyserver keyserver.ubuntu.com --receive-keys "$CABAL_INSTALL_RELEASE_KEY"; \
gpg --batch --verify SHA256SUMS.sig SHA256SUMS; \
# confirm we are verifying SHA256SUMS that matches the release + sha256
grep "$CABAL_INSTALL_SHA256 $CABAL_INSTALL_TAR" SHA256SUMS; \
gpgconf --kill all; \
\
tar -xf cabal-install.tar.gz -C /usr/local/bin; \
\
rm -rf /tmp/*; \
\
cabal --version
ARG GHC=9.2.8
ARG GHC_RELEASE_KEY=88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4
RUN set -eux; \
cd /tmp; \
ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)"; \
GHC_URL="https://downloads.haskell.org/~ghc/$GHC/ghc-$GHC-$ARCH-deb10-linux.tar.xz"; \
# sha256 from https://downloads.haskell.org/~ghc/$GHC/SHA256SUMS
case "$ARCH" in \
'aarch64') \
GHC_SHA256='645433359d8ad9e7b286f85ef5111db1b787ee3712c24c5dfde7c62769aa59a4'; \
;; \
'x86_64') \
GHC_SHA256='10d1be25487bcf99ac8eb77beaa220c85e69f8c1106f4219ce019206ecc0ac51'; \
;; \
*) echo >&2 "error: unsupported architecture '$ARCH'" ; exit 1 ;; \
esac; \
curl -sSL "$GHC_URL" -o ghc.tar.xz; \
echo "$GHC_SHA256 ghc.tar.xz" | sha256sum --strict --check; \
\
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
curl -sSL "$GHC_URL.sig" -o ghc.tar.xz.sig; \
gpg --batch --keyserver keyserver.ubuntu.com --receive-keys "$GHC_RELEASE_KEY"; \
gpg --batch --verify ghc.tar.xz.sig ghc.tar.xz; \
gpgconf --kill all; \
\
tar xf ghc.tar.xz; \
cd "ghc-$GHC"; \
./configure --prefix "/opt/ghc/$GHC"; \
make install; \
\
rm -rf /tmp/*; \
\
"/opt/ghc/$GHC/bin/ghc" --version
ENV PATH=/root/.cabal/bin:/root/.local/bin:/opt/ghc/${GHC}/bin:$PATH
CMD ["ghci"]