-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (47 loc) · 2.03 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
FROM docker.io/aesiniath/debian:buster
#
# Install wget (and certificates so https works) and the list of dependencies
# specified by the get_stack.sh script. And netbase, because who knew you needed
# to enable networking to get **http-client** to work. Da fu?
#
RUN apt-get update \
&& apt-get install --no-install-recommends --assume-yes \
wget ca-certificates \
g++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg \
netbase liblzma-dev libssl-dev \
&& apt-get clean
#
# Download the latest stack binary and put it in /usr/local/bin. Originally
# this went through <https://get.haskellstack.org/stable/linux-x86_64.tar.gz>,
# but knowing exactly what binary is being used to bootstrap is not
# the worst thing.
#
RUN wget -q -O - https://github.com/commercialhaskell/stack/releases/download/v2.3.3/stack-2.3.3-linux-x86_64.tar.gz \
| tar -x -z -C /usr/local/bin --strip-components=1 --wildcards '*stack'
#
# Download latest snapshot and install its compiler. By *not* specifying the
# snapshot the default latest will be plonked in /root/.stack/global-project
# and that will send in a compiler. If later RUN command specifies a snapshot
# that includes a newer compiler, then just nuke the docker image and redo.
# Otherwise you'll be redownloading the compiler every single time you build
# that layer.
#
ADD files/root/. /root
ADD files/usr/local/bin/. /usr/local/bin
RUN wget -q -O - https://github.com/commercialhaskell/stackage-content/raw/master/stack/stack-setup-2.yaml \
| patch-setup > /root/setup-info.yaml
ARG RESOLVER
RUN stack setup --resolver=$RESOLVER --setup-info-yaml=/root/setup-info.yaml \
&& cleanup
RUN stack update --resolver=$RESOLVER \
&& cleanup
#
# Now customize the snapshot and start downloading packages. The resolver is
# specified here as with the other layers, but the the list of dependencies to
# be built (and thus cached in the Docker image) are in listed in
# files/src/baselines/package.yaml.
#
WORKDIR /src/baseline
ADD files/src/ /src/
RUN stack build --resolver=$RESOLVER \
&& cleanup