Dockerfile for fpco/stack-build:lts-16.x

This commit is contained in:
Emanuel Borsboom 2020-06-18 19:05:16 -07:00
parent 47a9dfa6e4
commit f130e511ab
3 changed files with 100 additions and 4 deletions

View File

@ -296,7 +296,7 @@ info above).
### Building LTS minor releases
Before 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.
* 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.
* 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.
* 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.
First run `build.sh` to regenerate updated `ltsXX/work/constraints.yaml` and `ltsXX/work/snapshot-incomplete.yaml` files.

View File

@ -106,9 +106,15 @@ LTS_MINOR="${LTS_VERSION#*.}"
# Determine latest LTS version
#
mkdir -p $HOME/.local/bin
curl -o $HOME/.local/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x $HOME/.local/bin/jq
if [[ ! -x "$HOME/.local/bin/jq" ]]; then
mkdir -p $HOME/.local/bin
if [[ "$(uname)" = "Darwin" ]]; then
curl -o $HOME/.local/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64
else
curl -o $HOME/.local/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
fi
chmod +x $HOME/.local/bin/jq
fi
LATEST_LTS_SLUG=$($HOME/.local/bin/jq -r ".[\"lts\"]" $SNAPSHOTS)
LATEST_LTS_VERSION="${LATEST_LTS_SLUG#lts-}"

View File

@ -0,0 +1,90 @@
FROM ubuntu:18.04
LABEL maintainer="manny@fpcomplete.com"
ARG GHC_VERSION=8.8.3
ARG LTS_SLUG=lts-16.0
ARG PID1_VERSION=0.1.2.0
ARG STACK_VERSION=2.3.1
ARG CUDA_VERSION=10.0
ARG JVM_PATH=/usr/lib/jvm/java-8-openjdk-amd64
ARG LLVM_PATH=/usr/lib/llvm-7
ARG BOOTSTRAP_COMMIT=1afd08ff0a3c3627f17eb1b928d35f337db40e08
ARG DEBIAN_FRONTEND=noninteractive
ARG VARIANT=build
ARG STACK_ROOT=/home/stackage/.stack
#
# Set encoding to UTF-8 and PATH to find GHC and cabal/stack-installed binaries.
#
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
PATH=/root/.local/bin:/usr/local/cuda-$CUDA_VERSION/bin:$STACK_ROOT/programs/x86_64-linux/ghc-$GHC_VERSION/bin:$PATH \
CUDA_PATH=/usr/local/cuda-$CUDA_VERSION \
CPATH=$JVM_PATH/include:$JVM_PATH/include/linux:$LLVM_PATH/include
#
# Install pre-requisites
#
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget netbase ca-certificates g++ gcc libc6-dev libffi-dev libgmp-dev \
make xz-utils zlib1g-dev git gnupg libtinfo-dev jq && \
rm -rf /var/lib/apt/lists/*
#
# Use Stackage's debian-bootstrap.sh script to install system libraries and
# tools required to build any Stackage package.
# Re-installs 'stack' *after* running debian-bootstrap.sh since that may have
# installed a different version.
# In the case of 'small' image, just install Stack and GHC.
#
RUN if [ "$VARIANT" != "small" ]; then \
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; \
fi && \
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' && \
if [ "$VARIANT" = "small" ]; then \
stack setup --resolver ghc-$GHC_VERSION; \
fi && \
rm -rf /var/lib/apt/lists/* && \
cd $STACK_ROOT && \
find . -type f -not -path "./programs/x86_64-linux/ghc-$GHC_VERSION/*" -exec rm '{}' \; && \
find . -type d -print0 |sort -rz |xargs -0 rmdir 2>/dev/null || true
#
# Configure Stack to use the GHC installed in the Docker image rather than installing its own
#
RUN mkdir /etc/stack/ && \
echo "system-ghc: true" >/etc/stack/config.yaml
#
# Use 'stack' to install basic Haskell tools like alex, happy, and cpphs. We
# remove most of the STACK_ROOT afterward to save space, but keep the 'share'
# files that some of these tools require.
#
RUN stack --resolver=$LTS_SLUG --local-bin-path=/usr/bin install \
happy alex cpphs gtk2hs-buildtools hscolour hlint hindent && \
cd $STACK_ROOT && \
find . -type f -not -path './snapshots/*/share/*' -and -not -path "./programs/x86_64-linux/ghc-$GHC_VERSION/*" -exec rm '{}' \; && \
find . -type d -print0 |sort -rz |xargs -0 rmdir 2>/dev/null || true
#
# Install 'pid1' init daemon
#
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 && \
chown root:root /usr/local/sbin && \
chown root:root /usr/local/sbin/pid1
#
# Set up pid1 entrypoint and default command
#
ENTRYPOINT ["/usr/local/sbin/pid1"]
CMD ["bash"]