Skip to content

Commit 0ac86d3

Browse files
committed
Add Dockerfile for LTS 24.0
Signed-off-by: Mihai Maruseac <mihai.maruseac@gmail.com>
1 parent 150da98 commit 0ac86d3

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
FROM ubuntu:24.04
2+
3+
LABEL maintainer="manny@fpcomplete.com"
4+
5+
ARG GHC_VERSION=9.10.2
6+
ARG LTS_SLUG=lts-24.0
7+
ARG PID1_VERSION=0.1.2.0
8+
ARG STACK_VERSION=3.7.1
9+
ARG CUDA_VERSION=10.0
10+
ARG JVM_PATH=/usr/lib/jvm/java-8-openjdk-amd64
11+
ARG LLVM_PATH=/usr/lib/llvm-9
12+
ARG BOOTSTRAP_COMMIT=c99572a824b0e74f684bcbd8b9110f2ad9c5d6bb
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 docker/*.sh scripts to install system libraries and
40+
# tools required to build any Stackage package.
41+
# Re-installs 'stack' *after* running docker/*.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/commercialhaskell/stackage/$BOOTSTRAP_COMMIT/docker/01-build-server.sh https://raw.githubusercontent.com/commercialhaskell/stackage/$BOOTSTRAP_COMMIT/docker/02-apt-get-install.sh https://raw.githubusercontent.com/commercialhaskell/stackage/$BOOTSTRAP_COMMIT/docker/03-custom-install.sh https://raw.githubusercontent.com/commercialhaskell/stackage/$BOOTSTRAP_COMMIT/docker/04-cleanup.sh | sed "s/^GHCVER=9.0.1$/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"]

0 commit comments

Comments
 (0)