Skip to content

Commit

Permalink
Use ghcup for 8.10/buster
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Aug 22, 2021
1 parent d9bf04e commit b7329d1
Showing 1 changed file with 28 additions and 42 deletions.
70 changes: 28 additions & 42 deletions 8.10/buster/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,54 +1,40 @@
FROM debian:buster
FROM debian:buster AS builder

ENV LANG C.UTF-8

# install prerequisites
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
dirmngr \
g++ \
git \
gnupg \
libsqlite3-dev \
libtinfo-dev \
make \
netbase \
openssh-client \
xz-utils \
zlib1g-dev && \
build-essential \
libffi-dev \
libffi6 \
libgmp-dev \
libgmp10 \
libncurses-dev \
libncurses5 \
libtinfo5 \
curl && \
rm -rf /var/lib/apt/lists/*

ARG GHC=8.10.4
ARG DEBIAN_KEY=427CB69AAC9D00F2A43CAF1CBA3CBA3FFE22B574
ARG CABAL_INSTALL=3.4
# install ghcup
ARG GHCUP_VERSION=0.1.16.2
RUN curl --proto '=https' --tlsv1.2 -sSf https://downloads.haskell.org/~ghcup/$GHCUP_VERSION/x86_64-linux-ghcup-$GHCUP_VERSION > /usr/bin/ghcup && \
chmod +x /usr/bin/ghcup

RUN export GNUPGHOME="$(mktemp -d)" && \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys ${DEBIAN_KEY} && \
gpg --batch --armor --export ${DEBIAN_KEY} > /etc/apt/trusted.gpg.d/haskell.org.gpg.asc && \
gpgconf --kill all && \
echo 'deb http://downloads.haskell.org/debian buster main' > /etc/apt/sources.list.d/ghc.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
cabal-install-${CABAL_INSTALL} \
ghc-${GHC} && \
rm -rf "$GNUPGHOME" /var/lib/apt/lists/*

ARG STACK=2.7.3
ARG STACK_KEY=C5705533DA4F78D8664B5DC0575159689BEFB442
ARG STACK_RELEASE_KEY=2C6A674E85EE3FB896AFC9B965101FF31C5C154D
# install cabal
ARG CABAL_VERSION=3.4.0.0
RUN ghcup install cabal -i /usr/bin $CABAL_VERSION

RUN export GNUPGHOME="$(mktemp -d)" && \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys ${STACK_KEY} && \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys ${STACK_RELEASE_KEY} && \
curl -fSL https://github.com/commercialhaskell/stack/releases/download/v${STACK}/stack-${STACK}-linux-x86_64.tar.gz -o stack.tar.gz && \
curl -fSL https://github.com/commercialhaskell/stack/releases/download/v${STACK}/stack-${STACK}-linux-x86_64.tar.gz.asc -o stack.tar.gz.asc && \
gpg --batch --trusted-key 0x575159689BEFB442 --verify stack.tar.gz.asc stack.tar.gz && \
tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 && \
/usr/local/bin/stack config set system-ghc --global true && \
/usr/local/bin/stack config set install-ghc --global false && \
rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz.asc /stack.tar.gz
# install stack
ARG STACK_VERSION=2.7.3
RUN ghcup install stack -i /usr/bin $STACK_VERSION

ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/${CABAL_INSTALL}/bin:/opt/ghc/${GHC}/bin:$PATH
# install GHC into /opt/ghc
ARG GHC_VERSION=8.10.6
RUN ghcup install ghc -i /opt/ghc $GHC_VERSION

CMD ["ghci"]
# Adjust PATH
RUN echo 'export PATH="/opt/ghc/bin:$PATH"' >> /etc/profile.d/ghcup_path.sh && \
chmod +x /etc/profile.d/ghcup_path.sh
ENV PATH="/opt/ghc/bin:$PATH"

0 comments on commit b7329d1

Please sign in to comment.