From 27cb1a6fd655fec48e0a6ddeeeeddcb954224b20 Mon Sep 17 00:00:00 2001
From: Olivier Benz <olivier.benz@b-data.ch>
Date: Tue, 15 Aug 2023 07:34:28 +0200
Subject: [PATCH] Improve reproducibility of prior versions

- Minor updates to all Dockerfiles
---
 README.md                  |  2 +-
 bootstrap/amd64.Dockerfile |  4 ++--
 bootstrap/arm64.Dockerfile | 13 ++++++-------
 latest.Dockerfile          |  6 ++----
 prior/8.10.1.Dockerfile    | 12 +++++++-----
 prior/8.10.4.Dockerfile    | 12 +++++++-----
 prior/8.10.5.Dockerfile    | 16 +++++++++-------
 prior/8.10.6.Dockerfile    | 16 +++++++++-------
 prior/8.10.7.Dockerfile    | 16 +++++++++-------
 prior/8.8.4.Dockerfile     | 12 +++++++-----
 prior/9.0.1.Dockerfile     | 12 +++++++-----
 prior/9.0.2.Dockerfile     | 12 +++++++-----
 prior/9.2.1.Dockerfile     | 10 +++++-----
 prior/9.2.2.Dockerfile     | 10 +++++-----
 prior/9.2.3.Dockerfile     | 10 +++++-----
 prior/9.2.4.Dockerfile     | 10 +++++-----
 prior/9.2.5.Dockerfile     | 10 +++++-----
 prior/9.2.6.Dockerfile     | 10 +++++-----
 prior/9.2.7.Dockerfile     | 10 +++++-----
 prior/9.2.8.Dockerfile     |  6 ++----
 prior/9.4.1.Dockerfile     | 10 +++++-----
 prior/9.4.2.Dockerfile     | 10 +++++-----
 prior/9.4.3.Dockerfile     | 10 +++++-----
 prior/9.4.4.Dockerfile     | 10 +++++-----
 prior/9.4.5.Dockerfile     | 10 +++++-----
 prior/9.4.6.Dockerfile     |  6 ++----
 prior/9.6.1.Dockerfile     |  8 ++++----
 27 files changed, 141 insertions(+), 132 deletions(-)

diff --git a/README.md b/README.md
index 57cd48f..86b654f 100644
--- a/README.md
+++ b/README.md
@@ -82,7 +82,7 @@ include the Haskell Tool Stack (Stack).
 
 There is currently no GHC binary distribution for Alpine Linux (AArch64)
 available!  
-:exclamation: One must use the `--system-ghc --no-install-ghc` flags when using
+:exclamation: One must use the `--no-install-ghc --system-ghc` flags when using
 `stack` with the image for the `arm64/v8` architecture.
 
 ## Similar projects
diff --git a/bootstrap/amd64.Dockerfile b/bootstrap/amd64.Dockerfile
index d0eae83..4b28a05 100644
--- a/bootstrap/amd64.Dockerfile
+++ b/bootstrap/amd64.Dockerfile
@@ -8,7 +8,7 @@ ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 COPY ghc-8.8.patch /tmp/
 COPY cabal-0001-force-ld.gold.patch /tmp/
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -43,7 +43,7 @@ LABEL org.label-schema.license="MIT" \
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.8.3}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
diff --git a/bootstrap/arm64.Dockerfile b/bootstrap/arm64.Dockerfile
index d5925ef..aa0c311 100644
--- a/bootstrap/arm64.Dockerfile
+++ b/bootstrap/arm64.Dockerfile
@@ -8,7 +8,7 @@ ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 COPY ghc-8.8.patch /tmp/
 COPY cabal-0001-force-ld.gold.patch /tmp/
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -26,8 +26,8 @@ RUN apk add --update --no-cache \
     zlib-dev
 
 RUN cd /tmp/ \
-  && wget https://gitlab.b-data.ch/ghc/ghc-bootstrap-aarch64/-/raw/main/ghc-8.8.3-r0.apk \
-  && apk add --allow-untrusted ghc-8.8.3-r0.apk \
+  && curl -sSLO https://gitlab.b-data.ch/ghc/ghc-bootstrap-aarch64/-/raw/main/ghc-8.8.3-r0.apk \
+  && apk add --allow-untrusted --no-cache ghc-8.8.3-r0.apk \
   && curl -sSLO https://downloads.haskell.org/~cabal/cabal-install-$CABAL_VERSION/cabal-install-$CABAL_VERSION.tar.gz \
   && tar zxf cabal-install-$CABAL_VERSION.tar.gz \
   && cd /tmp/cabal-install-$CABAL_VERSION/ \
@@ -44,7 +44,7 @@ LABEL org.label-schema.license="MIT" \
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.8.3}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -74,9 +74,8 @@ RUN apk add --update --no-cache \
     zlib-dev \
     #zlib-static \
   && cd /tmp/ \
-  && wget https://gitlab.b-data.ch/ghc/ghc-bootstrap-aarch64/-/raw/main/ghc-8.8.3-r0.apk \
-  && apk add --allow-untrusted ghc-8.8.3-r0.apk \
-  && cd / \
+  && curl -sSLO https://gitlab.b-data.ch/ghc/ghc-bootstrap-aarch64/-/raw/main/ghc-8.8.3-r0.apk \
+  && apk add --allow-untrusted --no-cache ghc-8.8.3-r0.apk \
   && rm -rf /tmp/*
 
 COPY --from=bootstrap /root/.cabal/bin/cabal /usr/bin/cabal
diff --git a/latest.Dockerfile b/latest.Dockerfile
index 9ae84b7..8f916b7 100644
--- a/latest.Dockerfile
+++ b/latest.Dockerfile
@@ -11,7 +11,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -66,8 +66,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -107,7 +106,6 @@ RUN cd /tmp \
   && cd ghc-"$GHC_VERSION"-*-alpine-linux \
   && ./configure --disable-ld-override \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
diff --git a/prior/8.10.1.Dockerfile b/prior/8.10.1.Dockerfile
index 9ce86e1..1ab4dc7 100644
--- a/prior/8.10.1.Dockerfile
+++ b/prior/8.10.1.Dockerfile
@@ -6,7 +6,8 @@ FROM registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.8.4 as bootstrap
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.10.1}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk upgrade --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -50,11 +51,11 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
-  && cabal install cabal-install-$CABAL_VERSION
+  && cabal install --constraint 'Cabal-syntax<3.3' cabal-install-$CABAL_VERSION
 
 FROM alpine:3.13 as builder
 
@@ -65,7 +66,7 @@ LABEL org.label-schema.license="MIT" \
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.10.1}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -105,11 +106,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/8.10.4.Dockerfile b/prior/8.10.4.Dockerfile
index 2d38a33..40b74a3 100644
--- a/prior/8.10.4.Dockerfile
+++ b/prior/8.10.4.Dockerfile
@@ -6,7 +6,8 @@ FROM registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.8.4 as bootstrap
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.10.4}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk upgrade --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -50,11 +51,11 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
-  && cabal install cabal-install-$CABAL_VERSION
+  && cabal install --constraint 'Cabal-syntax<3.3' cabal-install-$CABAL_VERSION
 
 FROM alpine:3.13 as builder
 
@@ -65,7 +66,7 @@ LABEL org.label-schema.license="MIT" \
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.10.4}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -105,11 +106,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/8.10.5.Dockerfile b/prior/8.10.5.Dockerfile
index a7ff026..4fee517 100644
--- a/prior/8.10.5.Dockerfile
+++ b/prior/8.10.5.Dockerfile
@@ -6,7 +6,8 @@ FROM registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.8.4 as bootstrap
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.10.5}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk upgrade --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -26,8 +27,8 @@ RUN apk add --update --no-cache \
 RUN cd /tmp \
   && curl -sSLO https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-src.tar.xz \
   && curl -sSLO https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-src.tar.xz.sig \
-  && gpg --keyserver hkps://pgp.mit.edu:443 \
-    --receive-keys 588764FBE22D19C4 \
+  && gpg --keyserver hkps://keyserver.ubuntu.com:443 \
+    --receive-keys 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 \
   && gpg --verify ghc-$GHC_VERSION-src.tar.xz.sig ghc-$GHC_VERSION-src.tar.xz \
   && tar xf ghc-$GHC_VERSION-src.tar.xz \
   && cd ghc-$GHC_VERSION \
@@ -50,11 +51,11 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
-  && cabal install cabal-install-$CABAL_VERSION
+  && cabal install --constraint 'Cabal-syntax<3.3' cabal-install-$CABAL_VERSION
 
 FROM alpine:3.13 as builder
 
@@ -65,7 +66,7 @@ LABEL org.label-schema.license="MIT" \
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.10.5}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -105,11 +106,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/8.10.6.Dockerfile b/prior/8.10.6.Dockerfile
index bc59f05..7bc7192 100644
--- a/prior/8.10.6.Dockerfile
+++ b/prior/8.10.6.Dockerfile
@@ -6,7 +6,8 @@ FROM registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.8.4 as bootstrap
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.10.6}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk upgrade --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -26,8 +27,8 @@ RUN apk add --update --no-cache \
 RUN cd /tmp \
   && curl -sSLO https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-src.tar.xz \
   && curl -sSLO https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-src.tar.xz.sig \
-  && gpg --keyserver hkps://pgp.mit.edu:443 \
-    --receive-keys 588764FBE22D19C4 \
+  && gpg --keyserver hkps://keyserver.ubuntu.com:443 \
+    --receive-keys 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 \
   && gpg --verify ghc-$GHC_VERSION-src.tar.xz.sig ghc-$GHC_VERSION-src.tar.xz \
   && tar xf ghc-$GHC_VERSION-src.tar.xz \
   && cd ghc-$GHC_VERSION \
@@ -50,11 +51,11 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
-  && cabal install cabal-install-$CABAL_VERSION
+  && cabal install --constraint 'Cabal-syntax<3.3' cabal-install-$CABAL_VERSION
 
 FROM alpine:3.13 as builder
 
@@ -65,7 +66,7 @@ LABEL org.label-schema.license="MIT" \
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.10.6}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -105,11 +106,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/8.10.7.Dockerfile b/prior/8.10.7.Dockerfile
index 147d990..38dcc97 100644
--- a/prior/8.10.7.Dockerfile
+++ b/prior/8.10.7.Dockerfile
@@ -6,7 +6,8 @@ FROM registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.8.4 as bootstrap
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.10.7}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk upgrade --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -26,8 +27,8 @@ RUN apk add --update --no-cache \
 RUN cd /tmp \
   && curl -sSLO https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-src.tar.xz \
   && curl -sSLO https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-src.tar.xz.sig \
-  && gpg --keyserver hkps://pgp.mit.edu:443 \
-    --receive-keys 588764FBE22D19C4 \
+  && gpg --keyserver hkps://keyserver.ubuntu.com:443 \
+    --receive-keys 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 \
   && gpg --verify ghc-$GHC_VERSION-src.tar.xz.sig ghc-$GHC_VERSION-src.tar.xz \
   && tar xf ghc-$GHC_VERSION-src.tar.xz \
   && cd ghc-$GHC_VERSION \
@@ -50,11 +51,11 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
-  && cabal install cabal-install-$CABAL_VERSION
+  && cabal install --constraint 'Cabal-syntax<3.3' cabal-install-$CABAL_VERSION
 
 FROM alpine:3.13 as builder
 
@@ -65,7 +66,7 @@ LABEL org.label-schema.license="MIT" \
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.10.7}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -105,11 +106,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/8.8.4.Dockerfile b/prior/8.8.4.Dockerfile
index 53f00ca..e5ff612 100644
--- a/prior/8.8.4.Dockerfile
+++ b/prior/8.8.4.Dockerfile
@@ -6,7 +6,8 @@ FROM registry.gitlab.b-data.ch/ghc/ghc4pandoc:bootstrap as bootstrap
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.8.4}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk upgrade --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -50,11 +51,11 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
-  && cabal install cabal-install-$CABAL_VERSION
+  && cabal install --constraint 'Cabal-syntax<3.3' cabal-install-$CABAL_VERSION
 
 FROM alpine:3.12 as builder
 
@@ -65,7 +66,7 @@ LABEL org.label-schema.license="MIT" \
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-8.8.4}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.2.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -105,11 +106,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.0.1.Dockerfile b/prior/9.0.1.Dockerfile
index c538f79..d841b55 100644
--- a/prior/9.0.1.Dockerfile
+++ b/prior/9.0.1.Dockerfile
@@ -6,7 +6,8 @@ FROM registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.7 as bootstrap
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-9.0.1}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.4.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk upgrade --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -50,11 +51,11 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
-  && cabal install cabal-install-$CABAL_VERSION
+  && cabal install --constraint 'Cabal-syntax<3.5' cabal-install-$CABAL_VERSION
 
 FROM alpine:3.15 as builder
 
@@ -66,7 +67,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD:-9.0.1}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.4.0.0}
 ENV PATH=$PATH:/usr/lib/llvm10/bin
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -106,11 +107,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.0.2.Dockerfile b/prior/9.0.2.Dockerfile
index c44b679..4741225 100644
--- a/prior/9.0.2.Dockerfile
+++ b/prior/9.0.2.Dockerfile
@@ -6,7 +6,8 @@ FROM registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.7 as bootstrap
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-9.0.2}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.4.0.0}
 
-RUN apk add --update --no-cache \
+RUN apk upgrade --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -50,11 +51,11 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
-  && cabal install cabal-install-$CABAL_VERSION
+  && cabal install --constraint 'Cabal-syntax<3.5' cabal-install-$CABAL_VERSION
 
 FROM alpine:3.15 as builder
 
@@ -66,7 +67,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD:-9.0.2}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.4.0.0}
 ENV PATH=$PATH:/usr/lib/llvm10/bin
 
-RUN apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -106,11 +107,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.2.1.Dockerfile b/prior/9.2.1.Dockerfile
index 4b70767..b20536c 100644
--- a/prior/9.2.1.Dockerfile
+++ b/prior/9.2.1.Dockerfile
@@ -9,7 +9,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD:-9.2.1}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.6.0.0}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -56,7 +56,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -71,8 +71,7 @@ LABEL org.label-schema.license="MIT" \
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-9.2.1}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.6.0.0}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -112,11 +111,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.2.2.Dockerfile b/prior/9.2.2.Dockerfile
index ffb124a..9a1ee58 100644
--- a/prior/9.2.2.Dockerfile
+++ b/prior/9.2.2.Dockerfile
@@ -7,7 +7,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD:-9.2.2}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.6.2.0}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -51,7 +51,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -66,8 +66,7 @@ LABEL org.label-schema.license="MIT" \
 ENV GHC_VERSION=${GHC_VERSION_BUILD:-9.2.2}
 ENV CABAL_VERSION=${CABAL_VERSION_BUILD:-3.6.2.0}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -107,11 +106,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.2.3.Dockerfile b/prior/9.2.3.Dockerfile
index e035c03..8c38434 100644
--- a/prior/9.2.3.Dockerfile
+++ b/prior/9.2.3.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -54,7 +54,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -72,8 +72,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -113,11 +112,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.2.4.Dockerfile b/prior/9.2.4.Dockerfile
index 7be00d8..216d7a5 100644
--- a/prior/9.2.4.Dockerfile
+++ b/prior/9.2.4.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -54,7 +54,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -72,8 +72,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -113,11 +112,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.2.5.Dockerfile b/prior/9.2.5.Dockerfile
index 712abbd..c64c2cc 100644
--- a/prior/9.2.5.Dockerfile
+++ b/prior/9.2.5.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -54,7 +54,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -72,8 +72,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -113,11 +112,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.2.6.Dockerfile b/prior/9.2.6.Dockerfile
index e0046d3..30c939d 100644
--- a/prior/9.2.6.Dockerfile
+++ b/prior/9.2.6.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -54,7 +54,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -72,8 +72,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -113,11 +112,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.2.7.Dockerfile b/prior/9.2.7.Dockerfile
index d558c0d..19e5d80 100644
--- a/prior/9.2.7.Dockerfile
+++ b/prior/9.2.7.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -54,7 +54,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && make -j$((`nproc`+1)) \
+  && make -j"$(($(nproc)+1))" \
   && make binary-dist \
   && cabal update \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -73,8 +73,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -114,11 +113,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.2.8.Dockerfile b/prior/9.2.8.Dockerfile
index fdbf8ca..b0b4af9 100644
--- a/prior/9.2.8.Dockerfile
+++ b/prior/9.2.8.Dockerfile
@@ -11,7 +11,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -73,8 +73,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -114,7 +113,6 @@ RUN cd /tmp \
   && cd "ghc-$GHC_VERSION" \
   && ./configure --disable-ld-override --prefix=/usr \
   && make install \
-  && cd / \
   && rm -rf /tmp/* \
     "/usr/share/doc/ghc-$GHC_VERSION"/*
 
diff --git a/prior/9.4.1.Dockerfile b/prior/9.4.1.Dockerfile
index fd13368..23369c0 100644
--- a/prior/9.4.1.Dockerfile
+++ b/prior/9.4.1.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -46,7 +46,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   && cabal update \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && hadrian/build binary-dist -j$((`nproc`+1)) \
+  && hadrian/build binary-dist -j"$(($(nproc)+1))" \
     --flavour=perf+llvm+split_sections \
     --docs=none \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -64,8 +64,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -105,7 +104,6 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION-*-alpine-linux \
   && ./configure --disable-ld-override \
   && make install \
-  && cd / \
   && rm -rf /tmp/* \
   ## Somehow /tmp/ghc-$GHC_VERSION-*-alpine-linux
   ## ends up at /usr/local/share/doc/ghc-$GHC_VERSION
@@ -113,6 +111,8 @@ RUN cd /tmp \
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.4.2.Dockerfile b/prior/9.4.2.Dockerfile
index f45b6c6..bd063a3 100644
--- a/prior/9.4.2.Dockerfile
+++ b/prior/9.4.2.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -46,7 +46,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   && cabal update \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && hadrian/build binary-dist -j$((`nproc`+1)) \
+  && hadrian/build binary-dist -j"$(($(nproc)+1))" \
     --flavour=perf+llvm+split_sections \
     --docs=none \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -65,8 +65,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -106,7 +105,6 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION-*-alpine-linux \
   && ./configure --disable-ld-override \
   && make install \
-  && cd / \
   && rm -rf /tmp/* \
   ## Somehow /tmp/ghc-$GHC_VERSION-*-alpine-linux
   ## ends up at /usr/local/share/doc/ghc-$GHC_VERSION
@@ -114,6 +112,8 @@ RUN cd /tmp \
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.4.3.Dockerfile b/prior/9.4.3.Dockerfile
index 96399ae..bcddb22 100644
--- a/prior/9.4.3.Dockerfile
+++ b/prior/9.4.3.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -46,7 +46,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   && cabal update \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && hadrian/build binary-dist -j$((`nproc`+1)) \
+  && hadrian/build binary-dist -j"$(($(nproc)+1))" \
     --flavour=perf+llvm+split_sections \
     --docs=none \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -65,8 +65,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -106,11 +105,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION-*-alpine-linux \
   && ./configure --disable-ld-override \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.4.4.Dockerfile b/prior/9.4.4.Dockerfile
index 3969871..680e20a 100644
--- a/prior/9.4.4.Dockerfile
+++ b/prior/9.4.4.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -46,7 +46,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   && cabal update \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && hadrian/build binary-dist -j$((`nproc`+1)) \
+  && hadrian/build binary-dist -j"$(($(nproc)+1))" \
     --flavour=perf+llvm+split_sections \
     --docs=none \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -65,8 +65,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -106,11 +105,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION-*-alpine-linux \
   && ./configure --disable-ld-override \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.4.5.Dockerfile b/prior/9.4.5.Dockerfile
index d9bcaee..e28c76b 100644
--- a/prior/9.4.5.Dockerfile
+++ b/prior/9.4.5.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -46,7 +46,7 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   && cabal update \
   # See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
-  && hadrian/build binary-dist -j$((`nproc`+1)) \
+  && hadrian/build binary-dist -j"$(($(nproc)+1))" \
     --flavour=perf+llvm+split_sections \
     --docs=none \
   # See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
@@ -65,8 +65,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -106,11 +105,12 @@ RUN cd /tmp \
   && cd ghc-$GHC_VERSION-*-alpine-linux \
   && ./configure --disable-ld-override \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
diff --git a/prior/9.4.6.Dockerfile b/prior/9.4.6.Dockerfile
index db5bcd7..8e6b898 100644
--- a/prior/9.4.6.Dockerfile
+++ b/prior/9.4.6.Dockerfile
@@ -11,7 +11,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -66,8 +66,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -107,7 +106,6 @@ RUN cd /tmp \
   && cd ghc-"$GHC_VERSION"-*-alpine-linux \
   && ./configure --disable-ld-override \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
diff --git a/prior/9.6.1.Dockerfile b/prior/9.6.1.Dockerfile
index 45f17ed..d2ded6a 100644
--- a/prior/9.6.1.Dockerfile
+++ b/prior/9.6.1.Dockerfile
@@ -10,7 +10,7 @@ ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
 RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+  && apk add --no-cache \
     autoconf \
     automake \
     binutils-gold \
@@ -65,8 +65,7 @@ ARG CABAL_VERSION_BUILD
 ENV GHC_VERSION=${GHC_VERSION_BUILD} \
     CABAL_VERSION=${CABAL_VERSION_BUILD}
 
-RUN apk upgrade --no-cache \
-  && apk add --update --no-cache \
+RUN apk add --no-cache \
     bash \
     build-base \
     bzip2 \
@@ -106,13 +105,14 @@ RUN cd /tmp \
   && cd ghc-"$GHC_VERSION"-*-alpine-linux \
   && ./configure --disable-ld-override \
   && make install \
-  && cd / \
   && rm -rf /tmp/*
 
 FROM builder as tester
 
 WORKDIR /usr/local/src
 
+WORKDIR /usr/local/src
+
 COPY Main.hs Main.hs
 
 RUN ghc -static -optl-pthread -optl-static Main.hs \
-- 
GitLab