Dockerfile 2.69 KB
Newer Older
1 2
FROM debian:stretch

3 4
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

5
ENV LANG C.UTF-8
6

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
RUN apt-get update -qq; apt-get install --no-install-recommends -qy gnupg dirmngr \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# http://downloads.haskell.org/debian/
RUN echo 'deb http://downloads.haskell.org/debian stretch main' > /etc/apt/sources.list.d/ghc.list
RUN apt-key adv --keyserver keyserver.ubuntu.com  --recv-keys BA3CBA3FFE22B574

# Core build utilities
RUN apt-get update -qq && apt-get install --no-install-recommends -qy \
    zlib1g-dev libtinfo-dev libsqlite3-0 libsqlite3-dev libgmp-dev \
    ca-certificates g++ git make automake autoconf gcc \
    perl python3 texinfo xz-utils lbzip2 bzip2 patch openssh-client sudo time \
    jq wget curl \
    # For source distributions
    xutils-dev \
    # DWARF libraries
    libdw1 libdw-dev \
    # For nofib
    valgrind \
    # Documentation tools
    python3-sphinx texlive-xetex texlive-latex-extra texlive-binaries texlive-fonts-recommended lmodern texlive-generic-extra \
Matthew Pickering's avatar
Matthew Pickering committed
29 30 31
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

Ben Gamari's avatar
Ben Gamari committed
32

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
WORKDIR /tmp
# Install GHC and cabal
ENV GHC_VERSION 8.6.5
RUN curl https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-x86_64-deb9-linux.tar.xz | tar -Jx;
WORKDIR /tmp/ghc-$GHC_VERSION
RUN ./configure --prefix=/opt/ghc/$GHC_VERSION; \
    make install;

WORKDIR /tmp
RUN rm -rf /tmp/ghc-$GHC_VERSION
ENV PATH /opt/ghc/$GHC_VERSION/bin:$PATH

# Get Cabal
ENV CABAL_VERSION 2.4.1.0
RUN curl https://downloads.haskell.org/cabal/cabal-install-$CABAL_VERSION/cabal-install-$CABAL_VERSION-x86_64-unknown-linux.tar.xz | tar -Jx && \
    mv cabal /usr/local/bin/cabal
49

50 51 52 53 54 55 56 57 58
# LLVM
ENV LLVM_DIR /opt/llvm
ENV LLVM_VERSION 7.0.0
ENV PATH $LLVM_DIR/bin:$PATH
RUN curl http://releases.llvm.org/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-16.04.tar.xz | tar -xJC .; \
    mkdir $LLVM_DIR && \
    cp -R clang+llvm*/* $LLVM_DIR && \
    rm -R clang+llvm* && \
    llc --version
Matthew Pickering's avatar
Matthew Pickering committed
59

60 61 62 63
# Create a normal user.
RUN adduser ghc --gecos "GHC builds" --disabled-password
RUN echo "ghc ALL = NOPASSWD : ALL" > /etc/sudoers.d/ghc
USER ghc
Matthew Pickering's avatar
Matthew Pickering committed
64
WORKDIR /home/ghc/
65

66 67 68 69 70
# Build Haskell tools
RUN cabal v2-update && \
    cabal v2-install hscolour happy alex --constraint 'happy ^>= 1.19.10'
ENV PATH /home/ghc/.cabal/bin:$PATH

71
# Build Linting tools
72 73 74 75 76
RUN apt-get update -qq; apt-get install --no-install-recommends -qy python3-pip \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*
RUN pip3 install mypy==0.701

77
RUN cabal update
78 79
RUN git clone https://gitlab.haskell.org/ghc/git-haskell-org-hooks && \
    git -C git-haskell-org-hooks checkout 0df6168bdc1c52f9ebfd98a7b424e716f131330d
Matthew Pickering's avatar
Matthew Pickering committed
80 81 82
WORKDIR /home/ghc/git-haskell-org-hooks
RUN cabal install

83
CMD ["bash"]