diff --git a/latest.Dockerfile b/latest.Dockerfile
index f14eccd2af485223521a29b1c754c8a0df93bece..9ef16f6f602e3aca9b4fbf90abf098605df415ad 100644
--- a/latest.Dockerfile
+++ b/latest.Dockerfile
@@ -67,7 +67,7 @@ RUN cabal update \
   ## See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
   && cabal install "cabal-install-$CABAL_VERSION"
 
-FROM alpine:3.19 as ghc-stage1
+FROM alpine:3.19 as ghc-base
 
 LABEL org.opencontainers.image.licenses="MIT" \
       org.opencontainers.image.source="https://gitlab.b-data.ch/ghc/ghc-musl" \
@@ -116,6 +116,8 @@ RUN apk add --no-cache \
     zlib-dev \
     zlib-static
 
+FROM ghc-base as ghc-stage1
+
 COPY --from=bootstrap-ghc /tmp/ghc-"$GHC_VERSION"/_build/bindist/ghc-"$GHC_VERSION"-*-alpine-linux.tar.xz /tmp/
 
 RUN cd /tmp \
@@ -162,7 +164,10 @@ RUN ghc -static -optl-pthread -optl-static Main.hs \
   && cabal init -n --is-executable -p tester -l MIT \
   && cabal run
 
-FROM ghc-stage1
+FROM ghc-base
+
+## Install GHC and Stack
+COPY --from=ghc-stage1 /usr/local /usr/local
 
 ## Install Cabal (the tool) built with the GHC target version
 COPY --from=ghc-stage2 /root/.local/bin/cabal /usr/local/bin/cabal
diff --git a/prior/9.4.8.Dockerfile b/prior/9.4.8.Dockerfile
index 165fe6dcd3503325e770111190b79e0630951a73..d679110bbfe3c7ed0729baa787d00d3b33f55f72 100644
--- a/prior/9.4.8.Dockerfile
+++ b/prior/9.4.8.Dockerfile
@@ -67,7 +67,7 @@ RUN cabal update \
   ## See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
   && cabal install "cabal-install-$CABAL_VERSION"
 
-FROM alpine:3.19 as ghc-stage1
+FROM alpine:3.19 as ghc-base
 
 LABEL org.opencontainers.image.licenses="MIT" \
       org.opencontainers.image.source="https://gitlab.b-data.ch/ghc/ghc-musl" \
@@ -116,6 +116,8 @@ RUN apk add --no-cache \
     zlib-dev \
     zlib-static
 
+FROM ghc-base as ghc-stage1
+
 COPY --from=bootstrap-ghc /tmp/ghc-"$GHC_VERSION"/_build/bindist/ghc-"$GHC_VERSION"-*-alpine-linux.tar.xz /tmp/
 
 RUN cd /tmp \
@@ -162,7 +164,10 @@ RUN ghc -static -optl-pthread -optl-static Main.hs \
   && cabal init -n --is-executable -p tester -l MIT \
   && cabal run
 
-FROM ghc-stage1
+FROM ghc-base
+
+## Install GHC and Stack
+COPY --from=ghc-stage1 /usr/local /usr/local
 
 ## Install Cabal (the tool) built with the GHC target version
 COPY --from=ghc-stage2 /root/.cabal/bin/cabal /usr/local/bin/cabal
diff --git a/prior/9.6.4.Dockerfile b/prior/9.6.4.Dockerfile
index 48bf384de6bf8038f3840ec40118f3d77b59addd..8a11be240cafb5f9f74670ee4107aefae8d44018 100644
--- a/prior/9.6.4.Dockerfile
+++ b/prior/9.6.4.Dockerfile
@@ -67,7 +67,7 @@ RUN cabal update \
   ## See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history
   && cabal install "cabal-install-$CABAL_VERSION"
 
-FROM alpine:3.19 as ghc-stage1
+FROM alpine:3.19 as ghc-base
 
 LABEL org.opencontainers.image.licenses="MIT" \
       org.opencontainers.image.source="https://gitlab.b-data.ch/ghc/ghc-musl" \
@@ -116,6 +116,8 @@ RUN apk add --no-cache \
     zlib-dev \
     zlib-static
 
+FROM ghc-base as ghc-stage1
+
 COPY --from=bootstrap-ghc /tmp/ghc-"$GHC_VERSION"/_build/bindist/ghc-"$GHC_VERSION"-*-alpine-linux.tar.xz /tmp/
 
 RUN cd /tmp \
@@ -162,7 +164,10 @@ RUN ghc -static -optl-pthread -optl-static Main.hs \
   && cabal init -n --is-executable -p tester -l MIT \
   && cabal run
 
-FROM ghc-stage1
+FROM ghc-base
+
+## Install GHC and Stack
+COPY --from=ghc-stage1 /usr/local /usr/local
 
 ## Install Cabal (the tool) built with the GHC target version
 COPY --from=ghc-stage2 /root/.local/bin/cabal /usr/local/bin/cabal