From 1bf8f132cdad95df8e8fc303d3e3e123ad2587fc Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Jun 2023 08:15:15 +0530 Subject: [PATCH 1/6] Create image for ghc-9.4.5 --- ghc-musl.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ghc-musl.nix b/ghc-musl.nix index 33055e3..57e11c5 100644 --- a/ghc-musl.nix +++ b/ghc-musl.nix @@ -9,8 +9,8 @@ let alpineImage = pkgs.dockerTools.pullImage { imageName = "alpine"; imageDigest = - "sha256:e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501"; - sha256 = "sha256-YCYpUByIOig4zt/WIvDas3AwHjDYkIQJ6IEKuADJmgg="; + "sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70"; + sha256 = "82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1"; }; in pkgs.dockerTools.buildImage { From 84dd34d553bd40d5ecbccae1476a4b68e5951f1e Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Jun 2023 08:20:41 +0530 Subject: [PATCH 2/6] Update sha256 --- ghc-musl.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghc-musl.nix b/ghc-musl.nix index 57e11c5..c64c5e9 100644 --- a/ghc-musl.nix +++ b/ghc-musl.nix @@ -10,7 +10,7 @@ let imageName = "alpine"; imageDigest = "sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70"; - sha256 = "82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1"; + sha256 = "sha256-ymburWdn08/l5jqTAmdeXbBys0q01OmNuOVG4mnMzqk="; }; in pkgs.dockerTools.buildImage { From 3ea1d5915875e8be94ae3438c32bb9d948af98ba Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Jun 2023 08:29:38 +0530 Subject: [PATCH 3/6] Update revision --- .github/workflows/test.yaml | 7 ++++++- README.md | 13 ++++++++++++- ghc-musl.nix | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 69457d6..6d83e3a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -37,9 +37,14 @@ jobs: - name: Test image shell: bash run: just test-image - - name: Release + - name: Push image if: startsWith(github.ref, 'refs/tags/') shell: bash run: | set -exuo pipefail just push-image + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + generate_release_notes: true diff --git a/README.md b/README.md index f8b14f4..03c223a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ The images here are used to build the static binary for the Haskell's stack buil with proper location of include headers and library files to make the build working. -If you have to update the image for newer GHC, you have to update these things: +If you have to update the image for newer GHC, you have to update +these things: - The nixpkgs commit which has the specific GHC you want. Update the [ghc-musl.nix](./ghc-musl.nix) with the appropriate commit. @@ -28,6 +29,13 @@ If you have to update the image for newer GHC, you have to update these things: - Update the [justfile](./justfile) with the new GHC tag. - Update the stack version in the [Dockerfile](./Dockerfile). +For upgrading the base alpine images, these are the steps: + +- Get alpine image's SHA digest from [dockerhub](https://hub.docker.com/_/alpine/) and replace it in + ghc-musl.nix's imageDigest. +- Upgrade the sha256 based on the CI error message or use [skopeo](https://nixos.wiki/wiki/Docker#How_to_calculate_the_sha256_of_a_pulled_image) + to calcuate the hash. + # Building images We use [just](https://github.com/casey/just) tool to simplify the building process. To build image @@ -59,3 +67,6 @@ Version 2.9.3, Git revision 6cf638947a863f49857f9cfbf72a38a48b183e7e x86_64 hpac * [GHC 8.10.4](https://hub.docker.com/layers/fpco/alpine-haskell-stack/8.10.4/images/sha256-ff56997dc0cd1f859a342b6c4b0f069600e21574c9371657817ce8738c8461af?context=repo) * [GHC 8.8.3](https://hub.docker.com/layers/fpco/alpine-haskell-stack/gmp-ghc-8.8.3/images/sha256-bf1050a24b0a9d309ec98418e578ddce474dd60542da8f9367f36e4ed6498e8e?context=repo) * [GHC 8.6.5](https://hub.docker.com/layers/fpco/alpine-haskell-stack/8.6.5/images/sha256-49e7e15f3b1d3f882ba5bb701463b1d508fbf40e5aafce6ea31acd210da570ba?context=explore) + +Recent images are built using Github actions and uploaded to [github +container registry](https://github.com/orgs/fpco/packages?repo_name=alpine-haskell-stack). diff --git a/ghc-musl.nix b/ghc-musl.nix index c64c5e9..e9cb714 100644 --- a/ghc-musl.nix +++ b/ghc-musl.nix @@ -1,7 +1,7 @@ { pkgs ? import (builtins.fetchTarball { url = - "https://github.com/NixOS/nixpkgs/archive/81d5cb1550ef0a58c5ee529c743065cc93a7fb64.tar.gz"; + "https://github.com/NixOS/nixpkgs/archive/989a2b93b79dd0553028e83be5f5db7221476d76.tar.gz"; }) { } }: @@ -20,7 +20,7 @@ pkgs.dockerTools.buildImage { fromImage = alpineImage; contents = [ - pkgs.pkgsMusl.haskell.compiler.ghc927 + pkgs.pkgsMusl.haskell.compiler.ghc945 pkgs.pkgsMusl.zlib pkgs.pkgsMusl.zlib.dev pkgs.pkgsMusl.ncurses From 889351eaa0803b4f4a1f5a0a4fb2d83e5a8a7883 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Jun 2023 08:41:38 +0530 Subject: [PATCH 4/6] Update Dockerfile and documentation --- Dockerfile | 2 +- README.md | 3 ++- justfile | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3861c95..59d4a8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN apk upgrade --no-cache &&\ lld \ shadow # for stack --docker, provides groupadd -RUN curl -sSLo /usr/local/bin/stack https://github.com/commercialhaskell/stack/releases/download/v2.9.3/stack-2.9.3-linux-x86_64-bin && \ +RUN curl -sSLo /usr/local/bin/stack https://github.com/commercialhaskell/stack/releases/download/v2.11.1/stack-2.11.1-linux-x86_64-bin && \ chmod +x /usr/local/bin/stack # https://stackoverflow.com/a/41517423 diff --git a/README.md b/README.md index 03c223a..f04ac37 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,9 @@ these things: - Optionally, you can update the SHA of the base alpine image in the ghc-musl.nix file. It's optional, but good to have latest stable alpine image as the base image. -- Update the [justfile](./justfile) with the new GHC tag. - Update the stack version in the [Dockerfile](./Dockerfile). +- Create a PR to this repository. Once it's merged, create a tag and + it will push the image to ghcr.io For upgrading the base alpine images, these are the steps: diff --git a/justfile b/justfile index b3cfc32..8731980 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,4 @@ -GHC_VERSION := "9.2.7" +GHC_VERSION := `git describe --abbrev=0` # List all recipies default: From 22c6bfafb7409fa85ab859210037455d22b27690 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Jun 2023 08:42:28 +0530 Subject: [PATCH 5/6] Update to v22 --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6d83e3a..0f28f0f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -24,7 +24,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: cachix/install-nix-action@v19 + - uses: cachix/install-nix-action@v22 with: nix_path: nixpkgs=channel:nixos-unstable - name: Build images From b136b7c0895216e28802d57bdc6d2f091837d03e Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Mon, 19 Jun 2023 08:54:13 +0530 Subject: [PATCH 6/6] Use version in justfile itself --- .github/workflows/test.yaml | 4 ++-- README.md | 1 + justfile | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0f28f0f..2c36d96 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,6 +3,8 @@ name: Build on: pull_request: push: + tags: + - '*' branches: - master @@ -13,8 +15,6 @@ jobs: steps: - name: Clone project uses: actions/checkout@v2 - with: - submodules: "true" - uses: extractions/setup-just@v1 with: just-version: 1.8.0 diff --git a/README.md b/README.md index f04ac37..8a3cdda 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ these things: - Optionally, you can update the SHA of the base alpine image in the ghc-musl.nix file. It's optional, but good to have latest stable alpine image as the base image. +- Update the [justfile](./justfile) with the new GHC tag. - Update the stack version in the [Dockerfile](./Dockerfile). - Create a PR to this repository. Once it's merged, create a tag and it will push the image to ghcr.io diff --git a/justfile b/justfile index 8731980..6f7f863 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,4 @@ -GHC_VERSION := `git describe --abbrev=0` +GHC_VERSION := "9.4.5" # List all recipies default: