on master help sign in
Merge pull request #5645 from commercialhaskell/5642-bump-ghc-for-build-images

Bump GHC version for LTS 16.12

commita672584bcc0b76402e1990fc963992850ef57c11 authorMichael Snoyman <michael@snoyman.com> dateTue 15 Sep 2020, 20:59 (6 years ago) parent099cb44b6320f2
1 file changed+90
automated/dockerfiles/lts-16.12/Dockerfile+90
automated/dockerfiles/lts-16.12/Dockerfilenew file+90
@@ -0,0 +1,90 @@
1+FROM ubuntu:18.04
2+
3+LABEL maintainer="manny@fpcomplete.com"
4+
5+ARG GHC_VERSION=8.8.4
6+ARG LTS_SLUG=lts-16.12
7+ARG PID1_VERSION=0.1.2.0
8+ARG STACK_VERSION=2.3.3
9+ARG CUDA_VERSION=10.0
10+ARG JVM_PATH=/usr/lib/jvm/java-8-openjdk-amd64
11+ARG LLVM_PATH=/usr/lib/llvm-7
12+ARG BOOTSTRAP_COMMIT=1afd08ff0a3c3627f17eb1b928d35f337db40e08
13+
14+ARG DEBIAN_FRONTEND=noninteractive
15+ARG VARIANT=build
16+ARG STACK_ROOT=/home/stackage/.stack
17+
18+#
19+# Set encoding to UTF-8 and PATH to find GHC and cabal/stack-installed binaries.
20+#
21+
22+ENV LANG=C.UTF-8 \
23+ LC_ALL=C.UTF-8 \
24+ PATH=/root/.local/bin:/usr/local/cuda-$CUDA_VERSION/bin:$STACK_ROOT/programs/x86_64-linux/ghc-$GHC_VERSION/bin:$PATH \
25+ CUDA_PATH=/usr/local/cuda-$CUDA_VERSION \
26+ CPATH=$JVM_PATH/include:$JVM_PATH/include/linux:$LLVM_PATH/include
27+
28+#
29+# Install pre-requisites
30+#
31+
32+RUN apt-get update && \
33+ apt-get install -y --no-install-recommends \
34+ wget netbase ca-certificates g++ gcc libc6-dev libffi-dev libgmp-dev \
35+ make xz-utils zlib1g-dev git gnupg libtinfo-dev jq && \
36+ rm -rf /var/lib/apt/lists/*
37+
38+#
39+# Use Stackage's debian-bootstrap.sh script to install system libraries and
40+# tools required to build any Stackage package.
41+# Re-installs 'stack' *after* running debian-bootstrap.sh since that may have
42+# installed a different version.
43+# In the case of 'small' image, just install Stack and GHC.
44+#
45+
46+RUN if [ "$VARIANT" != "small" ]; then \
47+ wget -qO- https://raw.githubusercontent.com/fpco/stackage/$BOOTSTRAP_COMMIT/debian-bootstrap.sh | sed "s/^GHCVER=8.6.5$/GHCVER=$GHC_VERSION/" | GHCVER=$GHC_VERSION bash; \
48+ fi && \
49+ wget -qO- https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/stack-$STACK_VERSION-linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/bin '*/stack' && \
50+ if [ "$VARIANT" = "small" ]; then \
51+ stack setup --resolver ghc-$GHC_VERSION; \
52+ fi && \
53+ rm -rf /var/lib/apt/lists/* && \
54+ cd $STACK_ROOT && \
55+ find . -type f -not -path "./programs/x86_64-linux/ghc-$GHC_VERSION/*" -exec rm '{}' \; && \
56+ find . -type d -print0 |sort -rz |xargs -0 rmdir 2>/dev/null || true
57+
58+#
59+# Configure Stack to use the GHC installed in the Docker image rather than installing its own
60+#
61+
62+RUN mkdir /etc/stack/ && \
63+ echo "system-ghc: true" >/etc/stack/config.yaml
64+
65+#
66+# Use 'stack' to install basic Haskell tools like alex, happy, and cpphs. We
67+# remove most of the STACK_ROOT afterward to save space, but keep the 'share'
68+# files that some of these tools require.
69+#
70+
71+RUN stack --resolver=$LTS_SLUG --local-bin-path=/usr/bin install \
72+ happy alex cpphs gtk2hs-buildtools hscolour hlint hindent && \
73+ cd $STACK_ROOT && \
74+ find . -type f -not -path './snapshots/*/share/*' -and -not -path "./programs/x86_64-linux/ghc-$GHC_VERSION/*" -exec rm '{}' \; && \
75+ find . -type d -print0 |sort -rz |xargs -0 rmdir 2>/dev/null || true
76+
77+#
78+# Install 'pid1' init daemon
79+#
80+
81+RUN wget -O- "https://github.com/fpco/pid1/releases/download/v$PID1_VERSION/pid1-$PID1_VERSION-linux-x86_64.tar.gz" | tar xzf - -C /usr/local && \
82+ chown root:root /usr/local/sbin && \
83+ chown root:root /usr/local/sbin/pid1
84+
85+#
86+# Set up pid1 entrypoint and default command
87+#
88+
89+ENTRYPOINT ["/usr/local/sbin/pid1"]
90+CMD ["bash"]