Skip to content

Commit

Permalink
Upgrade to LTS 20.10 (GHC 9.2.5) (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazk authored Feb 9, 2023
1 parent 2f1d381 commit 0860c11
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 32 deletions.
118 changes: 87 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,57 +1,113 @@
FROM debian:10
# Based on https://github.com/haskell/docker-haskell/blob/fb5c774c38a7ab2e7d233d95368be0f899353496/8.8/buster/Dockerfile
# LTS Haskell 16.25 (2020-12-06) GHC 8.8.4
# See https://www.stackage.org/lts-16.25 for package versions
FROM debian:buster-slim
# Based on https://github.com/haskell/docker-haskell/blob/12cd297d7ccc2e97fe5e94548ae502b0cbb6735f/9.2/slim-buster/Dockerfile

ENV LANG=C.UTF-8

# common haskell + stack dependencies
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr; \
rm -rf /var/lib/apt/lists/*;

ENV GHC=8.8.4 CABAL_INSTALL=3.2 DEBIAN_KEY=427CB69AAC9D00F2A43CAF1CBA3CBA3FFE22B574 LTS_HASKELL=16.25
RUN set -ex; \
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} \
ca-certificates \
curl \
g++ \
ghc-${GHC} \
dpkg-dev \
git \
libsqlite3-dev \
gcc \
gnupg \
g++ \
libc6-dev \
libffi-dev \
libgmp-dev \
libnuma-dev \
libtinfo-dev \
make \
netbase \
openssh-client \
xz-utils \
zlib1g-dev \
# regex-pcre requires pcre
# for regex-pcre
libpcre3 \
libpcre3-dev \
pkg-config \
; \
rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /tmp/* /var/tmp/*;
rm -rf /var/lib/apt/lists/*;

ENV STACK=2.5.1 STACK_RELEASE_KEY=C5705533DA4F78D8664B5DC0575159689BEFB442
RUN set -ex; \
export GNUPGHOME="$(mktemp -d)"; \
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; \
ENV STACK=2.9.3 STACK_RELEASE_KEY=C5705533DA4F78D8664B5DC0575159689BEFB442
RUN set -eux; \
cd /tmp; \
STACK_URL="https://github.com/commercialhaskell/stack/releases/download/v${STACK}/stack-${STACK}-linux-x86_64.tar.gz"; \
# sha256 from https://github.com/commercialhaskell/stack/releases/download/v${STACK}/stack-${STACK}-linux-x86_64.tar.gz.sha256
STACK_SHA256='938f689dc45e2693ab1ca3ea215790b3786dfd531dcf6c0bf40842c24e579ae9'; \
curl -sSL "$STACK_URL" -o stack.tar.gz; \
echo "$STACK_SHA256 stack.tar.gz" | sha256sum --strict --check; \
\
curl -sSL "$STACK_URL.asc" -o stack.tar.gz.asc; \
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
gpg --batch --keyserver keyserver.ubuntu.com --receive-keys "$STACK_RELEASE_KEY"; \
gpg --batch --verify stack.tar.gz.asc stack.tar.gz; \
gpgconf --kill all; \
tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1; \
\
tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 "stack-$STACK-linux-x86_64/stack"; \
stack config set system-ghc --global true; \
stack config set install-ghc --global false; \
rm -rf "$GNUPGHOME" /var/lib/apt/lists/* /stack.tar.gz.asc /stack.tar.gz;
\
rm -rf /tmp/*; \
\
stack --version;

ENV PATH=/opt/cabal/${CABAL_INSTALL}/bin:/opt/ghc/${GHC}/bin:$PATH
ENV CABAL_INSTALL=3.8.1.0 CABAL_INSTALL_RELEASE_KEY=E9EC5616017C3EE26B33468CCE1ED8AE0B011D8C
RUN set -eux; \
cd /tmp; \
CABAL_INSTALL_TAR="cabal-install-$CABAL_INSTALL-x86_64-linux-deb10.tar.xz"; \
CABAL_INSTALL_URL="https://downloads.haskell.org/~cabal/cabal-install-$CABAL_INSTALL/$CABAL_INSTALL_TAR"; \
CABAL_INSTALL_SHA256SUMS_URL="https://downloads.haskell.org/~cabal/cabal-install-$CABAL_INSTALL/SHA256SUMS"; \
# sha256 from https://downloads.haskell.org/~cabal/cabal-install-$CABAL_INSTALL/SHA256SUMS
CABAL_INSTALL_SHA256='c71a1a46fd42d235bb86be968660815c24950e5da2d1ff4640da025ab520424b'; \
curl -fSL "$CABAL_INSTALL_URL" -o cabal-install.tar.gz; \
echo "$CABAL_INSTALL_SHA256 cabal-install.tar.gz" | sha256sum --strict --check; \
\
curl -sSLO "$CABAL_INSTALL_SHA256SUMS_URL"; \
curl -sSLO "$CABAL_INSTALL_SHA256SUMS_URL.sig"; \
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
gpg --batch --keyserver keyserver.ubuntu.com --receive-keys "$CABAL_INSTALL_RELEASE_KEY"; \
gpg --batch --verify SHA256SUMS.sig SHA256SUMS; \
# confirm we are verifying SHA256SUMS that matches the release + sha256
grep "$CABAL_INSTALL_SHA256 $CABAL_INSTALL_TAR" SHA256SUMS; \
gpgconf --kill all; \
\
tar -xf cabal-install.tar.gz -C /usr/local/bin; \
\
rm -rf /tmp/*; \
\
cabal --version;

ENV GHC=9.2.5 GHC_RELEASE_KEY=88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4
RUN set -eux; \
cd /tmp; \
GHC_URL="https://downloads.haskell.org/~ghc/$GHC/ghc-$GHC-x86_64-deb10-linux.tar.xz"; \
# sha256 from https://downloads.haskell.org/~ghc/$GHC/SHA256SUMS
GHC_SHA256='89f2df47d86a45593d6ba3fd3a44b627d100588cd59be257570dbe3f92b17c48'; \
curl -sSL "$GHC_URL" -o ghc.tar.xz; \
echo "$GHC_SHA256 ghc.tar.xz" | sha256sum --strict --check; \
\
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
curl -sSL "$GHC_URL.sig" -o ghc.tar.xz.sig; \
gpg --batch --keyserver keyserver.ubuntu.com --receive-keys "$GHC_RELEASE_KEY"; \
gpg --batch --verify ghc.tar.xz.sig ghc.tar.xz; \
gpgconf --kill all; \
\
tar xf ghc.tar.xz; \
cd "ghc-$GHC"; \
./configure --prefix "/opt/ghc/$GHC"; \
make install; \
# remove profiling support to save space
find "/opt/ghc/$GHC/" \( -name "*_p.a" -o -name "*.p_hi" \) -type f -delete; \
# remove some docs
rm -rf "/opt/ghc/$GHC/share/"; \
\
rm -rf /tmp/*; \
\
"/opt/ghc/$GHC/bin/ghc" --version;

ENV PATH=/opt/ghc/${GHC}/bin:$PATH

RUN set -ex; \
useradd --create-home codewarrior; \
Expand Down
2 changes: 1 addition & 1 deletion workspace/stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-16.25
resolver: lts-20.10

extra-deps:
- url: https://github.com/codewars/hspec-formatters-codewars/archive/v0.1.0.tar.gz
Expand Down

0 comments on commit 0860c11

Please sign in to comment.