on master help sign in
Dockerfile for fpco/stack-build:lts-16.x
commitf130e511ab2685a72320c9e26841e11b418b7476 authorEmanuel Borsboom <manny@fpcomplete.com> dateThu 18 Jun 2020, 19:05 (6 years ago) parent47a9dfa
3 files changed+100−4
CURATORS.md+1−1 automated/dockerfiles/build.sh+9−3 automated/dockerfiles/lts-16.0/Dockerfile+90
CURATORS.md+1−1
@@ -296,7 +296,7 @@ info above).
296296### Building LTS minor releases
297297Before running the build, please make sure that the Dockerfile in `automated/dockerfiles/lts-X.Y` is up to date, where X is the major version that you're building and Y is the latest minor version of X for which a Dockerfile exists.
298298 * If any changes need to be made, (eg, new GHC version), copy `automated/lts-X.Y/Dockerfile` to `automated/lts-X.Z/Dockerfile`, where Z is the minor version you're building, and include the new changes.
299− * If you are building the first release of a new LTS major version, create a new `lts-X.Z/Dockerfile` based on the previous LTS's, and adjust the variables at the top to match the requirements of the snapshot. Ensure that `STACK_VERSION` is the latest release of Stack, and `BOOTSTRAP_COMMIT` is the commit ID of this repo containing the version of the `bootstrap-commit.sh` used to build the snapshot.
299+ * If you are building the first release of a new LTS major version, create a new `lts-X.Z/Dockerfile` based on the previous LTS's, and adjust the variables at the top to match the requirements of the snapshot. Ensure that `STACK_VERSION` is the latest release of Stack, and `BOOTSTRAP_COMMIT` is the commit ID of this repo containing the version of the `bootstrap-commit.sh` used to build the snapshot. Also ensure the FROM image's Ubuntu version matches that used in the [root Dockerfile](Dockerfile) used to build this snapshot.
300300
301301First run `build.sh` to regenerate updated `ltsXX/work/constraints.yaml` and `ltsXX/work/snapshot-incomplete.yaml` files.
302302
automated/dockerfiles/build.sh+9−3
@@ -106,9 +106,15 @@ LTS_MINOR="${LTS_VERSION#*.}"
106106# Determine latest LTS version
107107#
108108
109−mkdir -p $HOME/.local/bin
110−curl -o $HOME/.local/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
111−chmod +x $HOME/.local/bin/jq
109+if [[ ! -x "$HOME/.local/bin/jq" ]]; then
110+ mkdir -p $HOME/.local/bin
111+ if [[ "$(uname)" = "Darwin" ]]; then
112+ curl -o $HOME/.local/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64
113+ else
114+ curl -o $HOME/.local/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
115+ fi
116+ chmod +x $HOME/.local/bin/jq
117+fi
112118
113119LATEST_LTS_SLUG=$($HOME/.local/bin/jq -r ".[\"lts\"]" $SNAPSHOTS)
114120LATEST_LTS_VERSION="${LATEST_LTS_SLUG#lts-}"
automated/dockerfiles/lts-16.0/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.3
6+ARG LTS_SLUG=lts-16.0
7+ARG PID1_VERSION=0.1.2.0
8+ARG STACK_VERSION=2.3.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-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"]