@@ -0,0 +1,89 @@
3+LABEL maintainer="manny@fpcomplete.com"
7+ARG PID1_VERSION=0.1.2.0
8+ARG STACK_VERSION=2.1.3
10+ARG JVM_PATH=/usr/lib/jvm/java-8-openjdk-amd64
11+ARG LLVM_PATH=/usr/lib/llvm-7
12+ARG BOOTSTRAP_COMMIT=77790c7bcb21fd8875871245df5c5c39a55ec0c1
13+ARG DEBIAN_FRONTEND=noninteractive
15+ARG STACK_ROOT=/home/stackage/.stack
18+# Set encoding to UTF-8 and PATH to find GHC and cabal/stack-installed binaries.
23+ PATH=/root/.local/bin:/usr/local/cuda-$CUDA_VERSION/bin:$STACK_ROOT/programs/x86_64-linux/ghc-$GHC_VERSION/bin:$PATH \
24+ CUDA_PATH=/usr/local/cuda-$CUDA_VERSION \
25+ CPATH=$JVM_PATH/include:$JVM_PATH/include/linux:$LLVM_PATH/include
28+# Install pre-requisites
31+RUN apt-get update && \
32+ apt-get install -y --no-install-recommends \
33+ wget netbase ca-certificates g++ gcc libc6-dev libffi-dev libgmp-dev \
34+ make xz-utils zlib1g-dev git gnupg libtinfo-dev && \
35+ rm -rf /var/lib/apt/lists/*
38+# Use Stackage's debian-bootstrap.sh script to install system libraries and
39+# tools required to build any Stackage package.
40+# Re-installs 'stack' *after* running debian-bootstrap.sh since that may have
41+# installed a different version.
42+# In the case of 'small' image, just install Stack and GHC.
45+RUN if [ "$VARIANT" != "small" ]; then \
46+ 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+ 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' && \
49+ if [ "$VARIANT" = "small" ]; then \
50+ stack setup --resolver ghc-$GHC_VERSION; \
52+ rm -rf /var/lib/apt/lists/* && \
54+ find . -type f -not -path "./programs/x86_64-linux/ghc-$GHC_VERSION/*" -exec rm '{}' \; && \
55+ find . -type d -print0 |sort -rz |xargs -0 rmdir 2>/dev/null || true
58+# Configure Stack to use the GHC installed in the Docker image rather than installing its own
61+RUN mkdir /etc/stack/ && \
62+ echo "system-ghc: true" >/etc/stack/config.yaml
65+# Use 'stack' to install basic Haskell tools like alex, happy, and cpphs. We
66+# remove most of the STACK_ROOT afterward to save space, but keep the 'share'
67+# files that some of these tools require.
70+RUN stack --resolver=$LTS_SLUG --local-bin-path=/usr/bin install \
71+ happy alex cpphs gtk2hs-buildtools hscolour hlint hindent && \
73+ find . -type f -not -path './snapshots/*/share/*' -and -not -path "./programs/x86_64-linux/ghc-$GHC_VERSION/*" -exec rm '{}' \; && \
74+ find . -type d -print0 |sort -rz |xargs -0 rmdir 2>/dev/null || true
77+# Install 'pid1' init daemon
80+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 && \
81+ chown root:root /usr/local/sbin && \
82+ chown root:root /usr/local/sbin/pid1
85+# Set up pid1 entrypoint and default command
88+ENTRYPOINT ["/usr/local/sbin/pid1"]