From ba086a415412d13a601fe42d4ff860d079f4febd Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Thu, 4 Aug 2022 07:42:54 -0400 Subject: [PATCH 1/9] Remove Stack and HLS --- Dockerfile | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9c3437d..3609fe2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,22 +66,6 @@ RUN \ ghcup install cabal "$CABAL_VERSION" --set; \ cabal --version -# Install Stack. - -ARG STACK_VERSION=2.7.5 -RUN \ - set -o errexit -o xtrace; \ - ghcup install stack "$STACK_VERSION" --set; \ - stack --version - -# Install HLS. - -ARG HLS_VERSION=1.7.0.0 -RUN \ - set -o errexit -o xtrace; \ - ghcup install hls "$HLS_VERSION" --set; \ - haskell-language-server-wrapper --version - # Configure Cabal. ARG CABAL_STORE=/cabal-store @@ -92,22 +76,7 @@ RUN \ sudo chgrp sudo "$CABAL_STORE"; \ cabal user-config init --augment "store-dir: $CABAL_STORE" -# Configure Stack. - -ARG STACK_ROOT=/stack-root -RUN \ - set -o errexit -o xtrace; \ - sudo mkdir --mode 0775 --parents "$STACK_ROOT"; \ - sudo chown "$USER_NAME" "$STACK_ROOT"; \ - sudo chgrp sudo "$STACK_ROOT"; \ - stack config set install-ghc --global false; \ - stack config set system-ghc --global true -ENV STACK_ROOT="$STACK_ROOT" - # Configure volumes. VOLUME "/home/$USER_NAME/.cabal" -VOLUME "/home/$USER_NAME/.cache" -VOLUME "/home/$USER_NAME/.stack" VOLUME "$CABAL_STORE" -VOLUME "$STACK_ROOT" From 8b37fc7e2a6e7a0616198fdb2878128ad78e4744 Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Thu, 4 Aug 2022 08:03:04 -0400 Subject: [PATCH 2/9] Try to add caching --- .github/workflows/workflow.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 76fba22..3dcf8b1 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -21,6 +21,8 @@ jobs: username: ${{ github.actor }} - uses: docker/build-push-action@v3 with: + cache-from: type=gha + cache-to: type=gha,mode=max labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64,linux/arm64 push: true From 54abedd5c53f1f3233a2f96c1d92f4c81f40d6ea Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Thu, 4 Aug 2022 08:12:50 -0400 Subject: [PATCH 3/9] Remove GHC's profiling libraries and documentation --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 3609fe2..97898b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,6 +56,7 @@ ARG GHC_VERSION=9.0.2 RUN \ set -o errexit -o xtrace; \ ghcup install ghc "$GHC_VERSION" --set; \ + ghcup gc --profiling-libs --share-dir; \ ghc --version # Install Cabal. From 49fe944861ca1d7f04b1c3b87769861af05f9f4a Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Thu, 4 Aug 2022 08:51:22 -0400 Subject: [PATCH 4/9] Create README.markdown --- README.markdown | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.markdown diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..3eb56e1 --- /dev/null +++ b/README.markdown @@ -0,0 +1 @@ +# docker-haskell From fc1c1882bf3a73015831ac368b51f0ad38eee06a Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Thu, 4 Aug 2022 08:57:14 -0400 Subject: [PATCH 5/9] Set up a GHC version build matrix --- .github/workflows/workflow.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 3dcf8b1..4ad7587 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -2,7 +2,11 @@ name: Workflow on: push jobs: docker: - name: Docker + strategy: + matrix: + ghc: + - 9.0.2 + name: Docker with GHC ${{ matrix.ghc }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -13,7 +17,9 @@ jobs: with: images: ghcr.io/${{ github.repository }} flavor: latest=false - tags: type=sha,format=long + tags: | + type=sha,format=long,prefix=${{ matrix.ghc }}- + type=raw,value=${{ matrix.ghc }},enable={{ is_default_branch }} - uses: docker/login-action@v2 with: password: ${{ secrets.GITHUB_TOKEN }} @@ -21,6 +27,7 @@ jobs: username: ${{ github.actor }} - uses: docker/build-push-action@v3 with: + build-args: GHC_VERSION=${{ matrix.ghc }} cache-from: type=gha cache-to: type=gha,mode=max labels: ${{ steps.meta.outputs.labels }} From c14a91d907b6165013a735967c767009da4fcc8e Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Thu, 4 Aug 2022 09:01:21 -0400 Subject: [PATCH 6/9] Also build GHC 9.2.4 --- .github/workflows/workflow.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 4ad7587..f77b285 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -6,6 +6,7 @@ jobs: matrix: ghc: - 9.0.2 + - 9.2.4 name: Docker with GHC ${{ matrix.ghc }} runs-on: ubuntu-latest steps: From 28cd8d8da02c8f7fa621e71a617015763753558d Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Thu, 4 Aug 2022 10:57:18 -0400 Subject: [PATCH 7/9] Add Stack and HLS back in --- Dockerfile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Dockerfile b/Dockerfile index 97898b4..5fa1157 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,6 +67,23 @@ RUN \ ghcup install cabal "$CABAL_VERSION" --set; \ cabal --version +# Install Stack. + +ARG STACK_VERSION=2.7.5 +RUN \ + set -o errexit -o xtrace; \ + ghcup install stack "$STACK_VERSION" --set; \ + stack --version + +# Install HLS. + +ARG HLS_VERSION=1.7.0.0 +RUN \ + set -o errexit -o xtrace; \ + ghcup install hls "$HLS_VERSION" --set; \ + ghcup gc --hls-no-ghc; \ + haskell-language-server-wrapper --version + # Configure Cabal. ARG CABAL_STORE=/cabal-store @@ -77,7 +94,22 @@ RUN \ sudo chgrp sudo "$CABAL_STORE"; \ cabal user-config init --augment "store-dir: $CABAL_STORE" +# Configure Stack. + +ARG STACK_ROOT=/stack-root +RUN \ + set -o errexit -o xtrace; \ + sudo mkdir --mode 0775 --parents "$STACK_ROOT"; \ + sudo chown "$USER_NAME" "$STACK_ROOT"; \ + sudo chgrp sudo "$STACK_ROOT"; \ + stack config set install-ghc --global false; \ + stack config set system-ghc --global true +ENV STACK_ROOT="$STACK_ROOT" + # Configure volumes. VOLUME "/home/$USER_NAME/.cabal" +VOLUME "/home/$USER_NAME/.cache" +VOLUME "/home/$USER_NAME/.stack" VOLUME "$CABAL_STORE" +VOLUME "$STACK_ROOT" From 5c380500efb138bdb0180e1e123cdecb0b8891f4 Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Thu, 4 Aug 2022 11:00:59 -0400 Subject: [PATCH 8/9] Remove GHC 9.2.4 --- .github/workflows/workflow.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index f77b285..4ad7587 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -6,7 +6,6 @@ jobs: matrix: ghc: - 9.0.2 - - 9.2.4 name: Docker with GHC ${{ matrix.ghc }} runs-on: ubuntu-latest steps: From fb971192cf8b648d3584e2d8aa0824f0e7abc779 Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Thu, 4 Aug 2022 11:41:37 -0400 Subject: [PATCH 9/9] Update README.markdown --- README.markdown | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.markdown b/README.markdown index 3eb56e1..4165f87 100644 --- a/README.markdown +++ b/README.markdown @@ -1 +1,9 @@ # docker-haskell + +This Docker image provides a Haskell development environment with the following tools: + +- [GHCup](https://www.haskell.org/ghcup/) +- [GHC](https://www.haskell.org/ghc/) +- [Cabal](https://www.haskell.org/cabal/) +- [Stack](https://docs.haskellstack.org/en/stable/README/) +- [HLS](https://haskell-language-server.readthedocs.io/en/latest/)