Skip to content

Commit

Permalink
Merge pull request #11 from fpco/update-9.4.5
Browse files Browse the repository at this point in the history
Create image for ghc-9.4.5
  • Loading branch information
psibi authored Jun 19, 2023
2 parents ea42173 + b136b7c commit 7df4a5e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Build
on:
pull_request:
push:
tags:
- '*'
branches:
- master

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -27,6 +28,15 @@ If you have to update the image for newer GHC, you have to update these things:
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:

- 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

Expand Down Expand Up @@ -59,3 +69,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).
8 changes: 4 additions & 4 deletions ghc-musl.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{ pkgs ? import
(builtins.fetchTarball {
url =
"https://github.com/NixOS/nixpkgs/archive/81d5cb1550ef0a58c5ee529c743065cc93a7fb64.tar.gz";
"https://github.com/NixOS/nixpkgs/archive/989a2b93b79dd0553028e83be5f5db7221476d76.tar.gz";
})
{ }
}:
let
alpineImage = pkgs.dockerTools.pullImage {
imageName = "alpine";
imageDigest =
"sha256:e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501";
sha256 = "sha256-YCYpUByIOig4zt/WIvDas3AwHjDYkIQJ6IEKuADJmgg=";
"sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70";
sha256 = "sha256-ymburWdn08/l5jqTAmdeXbBys0q01OmNuOVG4mnMzqk=";
};
in
pkgs.dockerTools.buildImage {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GHC_VERSION := "9.2.7"
GHC_VERSION := "9.4.5"

# List all recipies
default:
Expand Down

0 comments on commit 7df4a5e

Please sign in to comment.