Dockerfile 1.69 KB
Newer Older
1 2 3 4
FROM debian:stretch

ENV LANG C.UTF-8

5 6
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

7 8
RUN echo 'deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main' > /etc/apt/sources.list.d/ghc.list

Ben Gamari's avatar
Ben Gamari committed
9 10
RUN apt-get update -qq; apt-get install --no-install-recommends -qy \
      gnupg sudo git python3 dirmngr ca-certificates curl xz-utils \
Matthew Pickering's avatar
Matthew Pickering committed
11 12
    && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6F88286 \
    && apt-get update \
Ben Gamari's avatar
Ben Gamari committed
13
    && apt-get install --no-install-recommends -qy python3-pip \
Matthew Pickering's avatar
Matthew Pickering committed
14 15 16
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

Ben Gamari's avatar
Ben Gamari committed
17 18
RUN pip3 install mypy==0.701

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
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
35

Matthew Pickering's avatar
Matthew Pickering committed
36 37
RUN mkdir -p /opt/local/bin

38 39 40 41 42
# 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
43
WORKDIR /home/ghc/
44

45 46
# Build Linting tools
RUN cabal update
47 48
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
49 50 51
WORKDIR /home/ghc/git-haskell-org-hooks
RUN cabal install

52

Matthew Pickering's avatar
Matthew Pickering committed
53 54 55 56 57 58
USER root
RUN mv /home/ghc/.cabal/bin/* /opt/local/bin/
RUN rm -rf /home/ghc/*

USER ghc
WORKDIR /home/ghc
59 60

CMD ["bash"]