From 47bc5a55659949ca75b077cf2a70e1ad10619582 Mon Sep 17 00:00:00 2001 From: Olivier Benz <olivier.benz@b-data.ch> Date: Tue, 16 Jan 2024 09:49:47 +0100 Subject: [PATCH] Update Dockerfiles for GHC versions 9.8.1, 9.6.4 and 9.4.8 - Reduce images size by about 200 MB - Close https://github.com/benz0li/ghc-musl/issues/6 --- latest.Dockerfile | 9 +++++++-- prior/9.4.8.Dockerfile | 9 +++++++-- prior/9.6.4.Dockerfile | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/latest.Dockerfile b/latest.Dockerfile index f14eccd..9ef16f6 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 165fe6d..d679110 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 48bf384..8a11be2 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 -- GitLab