@@ -0,0 +1,90 @@
3+LABEL maintainer="manny@fpcomplete.com"
7+ARG PID1_VERSION=0.1.2.0
8+ARG STACK_VERSION=2.3.3
10+ARG JVM_PATH=/usr/lib/jvm/java-8-openjdk-amd64
11+ARG LLVM_PATH=/usr/lib/llvm-7
12+ARG BOOTSTRAP_COMMIT=1afd08ff0a3c3627f17eb1b928d35f337db40e08
14+ARG DEBIAN_FRONTEND=noninteractive
16+ARG STACK_ROOT=/home/stackage/.stack
19+# Set encoding to UTF-8 and PATH to find GHC and cabal/stack-installed binaries.
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
29+# Install pre-requisites
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/*
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.
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; \
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; \
53+ rm -rf /var/lib/apt/lists/* && \
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
59+# Configure Stack to use the GHC installed in the Docker image rather than installing its own
62+RUN mkdir /etc/stack/ && \
63+ echo "system-ghc: true" >/etc/stack/config.yaml
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.
71+RUN stack --resolver=$LTS_SLUG --local-bin-path=/usr/bin install \
72+ happy alex cpphs gtk2hs-buildtools hscolour hlint hindent && \
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
78+# Install 'pid1' init daemon
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
86+# Set up pid1 entrypoint and default command
89+ENTRYPOINT ["/usr/local/sbin/pid1"]