From 63039a2dc0af63a3356c2af4262053f77040c3af Mon Sep 17 00:00:00 2001 From: Christopher Sasarak Date: Thu, 15 Aug 2024 20:51:29 -0500 Subject: [PATCH 01/10] Do install manuall on aarch64. --- ghc-9.8.2/Dockerfile | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/ghc-9.8.2/Dockerfile b/ghc-9.8.2/Dockerfile index 188dc81..6632aaf 100644 --- a/ghc-9.8.2/Dockerfile +++ b/ghc-9.8.2/Dockerfile @@ -11,15 +11,37 @@ RUN apk --no-cache add binutils-gold curl gcc g++ git gmp-dev ncurses-dev ncurse # Install system deps for FOSSA CLI: RUN apk --no-cache add bash xz-libs xz-dev bzip2-dev bzip2-static upx curl jq -ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=1 -ENV BOOTSTRAP_HASKELL_MINIMAL=1 +ENV GHC_VERSION="9.8.2" + ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:$PATH" -RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh -RUN ghcup install ghc 9.8.2 +RUN < Date: Fri, 16 Aug 2024 01:55:59 -0500 Subject: [PATCH 02/10] Dump docs. --- ghc-9.8.2/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ghc-9.8.2/Dockerfile b/ghc-9.8.2/Dockerfile index 6632aaf..5400ac6 100644 --- a/ghc-9.8.2/Dockerfile +++ b/ghc-9.8.2/Dockerfile @@ -29,6 +29,10 @@ RUN < Date: Tue, 20 Aug 2024 10:10:04 -0500 Subject: [PATCH 03/10] Add commentary. Set up the build job to make multiplatform images. --- .github/workflows/build-docker.yml | 23 +++++++++++++++-------- ghc-9.8.2/Dockerfile | 7 ++++++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index c996f1e..71d323b 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -14,21 +14,28 @@ jobs: strategy: matrix: - ghc-version: - - ghc-8.8.4 - - ghc-8.10.7 - - ghc-9.0.2 - - ghc-9.4.7 - - ghc-9.4.8 - - ghc-9.8.2 + include: + - ghc-version: ghc-8.8.4 + platform: linux/amd64 + - ghc-version: ghc-8.10.7 + platform: linux/amd64 + - ghc-version: ghc-9.0.2 + platform: linux/amd64 + - ghc-version: ghc-9.4.7 + platform: linux/amd64 + - ghc-version: ghc-9.4.8 + platform: linux/amd64 + - ghc-version: ghc-9.8.2 + platform: linux/amd64,linux/arm64 steps: - uses: actions/checkout@v2 - name: Build image - run: docker build ./${{ matrix.ghc-version }} --tag $IMAGE_NAME:${{ matrix.ghc-version }} + run: docker build ./${{ matrix.ghc-version }} --platform ${{ matrix.platform }} --tag $IMAGE_NAME:${{ matrix.ghc-version }} - name: Log into registry + if: ${{ github.ref == 'refs/heads/master' }} run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u fossabot --password-stdin - name: Push image diff --git a/ghc-9.8.2/Dockerfile b/ghc-9.8.2/Dockerfile index 6fcc4e8..e112355 100644 --- a/ghc-9.8.2/Dockerfile +++ b/ghc-9.8.2/Dockerfile @@ -15,6 +15,11 @@ ENV GHC_VERSION="9.8.2" ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:$PATH" +# There aren't official builds of ghcup that are built against musl for aarch64. +# So the following two steps do the install manually on that platform. +# They manually do the same steps that ghcup would. +# ghcup should have support for this soon: https://github.com/haskell/ghcup-hs/issues/1012#issuecomment-2294829976 +# When that happens, you should be able to remove the 'else' branches and have the install work for all platforms. RUN < Date: Tue, 20 Aug 2024 10:12:40 -0500 Subject: [PATCH 04/10] Set up qemu and buildx for multiplatform images. --- .github/workflows/build-docker.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 71d323b..07eed7f 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -29,6 +29,12 @@ jobs: platform: linux/amd64,linux/arm64 steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - uses: actions/checkout@v2 - name: Build image From 1c2e101c0b710c1c00a808d0a5c3d4a003d8ad8d Mon Sep 17 00:00:00 2001 From: Christopher Sasarak Date: Tue, 20 Aug 2024 10:20:23 -0500 Subject: [PATCH 05/10] Try using actions to see if that make multiplatform easier. --- .github/workflows/build-docker.yml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 07eed7f..e43698e 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -37,13 +37,28 @@ jobs: - uses: actions/checkout@v2 - - name: Build image - run: docker build ./${{ matrix.ghc-version }} --platform ${{ matrix.platform }} --tag $IMAGE_NAME:${{ matrix.ghc-version }} + # - name: Build image + # run: docker build ./${{ matrix.ghc-version }} --platform ${{ matrix.platform }} --tag $IMAGE_NAME:${{ matrix.ghc-version }} - - name: Log into registry + - name: Login to Docker Hub if: ${{ github.ref == 'refs/heads/master' }} - run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u fossabot --password-stdin + uses: docker/login-action@v3 + with: + username: ${{ fossabot }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} - - name: Push image - if: ${{ github.ref == 'refs/heads/master' }} - run: docker push $IMAGE_NAME:${{ matrix.ghc-version }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + file: ${{ format('./{0}', matrix.ghc-version) }} + push: false # ${{ github.ref == 'refs/heads/master' }} + tags: ${{ format('{0}:{1}', env.IMAGE_NAME, matrix.ghc-version }} + + # - name: Log into registry + # if: ${{ github.ref == 'refs/heads/master' }} + # run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u fossabot --password-stdin + + # - name: Push image + # if: ${{ github.ref == 'refs/heads/master' }} + # run: docker push $IMAGE_NAME:${{ matrix.ghc-version }} From a05e810eec7708d6586e0cc02449fea77001e2e2 Mon Sep 17 00:00:00 2001 From: Christopher Sasarak Date: Tue, 20 Aug 2024 10:21:26 -0500 Subject: [PATCH 06/10] bad. --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index e43698e..1e7e4f4 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -44,7 +44,7 @@ jobs: if: ${{ github.ref == 'refs/heads/master' }} uses: docker/login-action@v3 with: - username: ${{ fossabot }} + username: fossabot password: ${{ secrets.DOCKER_HUB_TOKEN }} - name: Build and push From c4de6526492ef4a1d446146e6f54381e630b520d Mon Sep 17 00:00:00 2001 From: Christopher Sasarak Date: Tue, 20 Aug 2024 10:23:26 -0500 Subject: [PATCH 07/10] more bad. --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 1e7e4f4..dce0c90 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -53,7 +53,7 @@ jobs: platforms: linux/amd64,linux/arm64 file: ${{ format('./{0}', matrix.ghc-version) }} push: false # ${{ github.ref == 'refs/heads/master' }} - tags: ${{ format('{0}:{1}', env.IMAGE_NAME, matrix.ghc-version }} + tags: ${{ format('{0}:{1}', env.IMAGE_NAME, matrix.ghc-version) }} # - name: Log into registry # if: ${{ github.ref == 'refs/heads/master' }} From 18af5a443de78999714711ce0319d387b8c1b238 Mon Sep 17 00:00:00 2001 From: Christopher Sasarak Date: Tue, 20 Aug 2024 10:24:58 -0500 Subject: [PATCH 08/10] pass dockerfile instead of dir. --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index dce0c90..ff96a67 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -51,7 +51,7 @@ jobs: uses: docker/build-push-action@v6 with: platforms: linux/amd64,linux/arm64 - file: ${{ format('./{0}', matrix.ghc-version) }} + file: ${{ format('./{0}/Dockerfile', matrix.ghc-version) }} push: false # ${{ github.ref == 'refs/heads/master' }} tags: ${{ format('{0}:{1}', env.IMAGE_NAME, matrix.ghc-version) }} From 556ca9e794723a59bf92cf83daa4f06231f7c957 Mon Sep 17 00:00:00 2001 From: Christopher Sasarak Date: Tue, 20 Aug 2024 10:28:09 -0500 Subject: [PATCH 09/10] Pass platform param. --- .github/workflows/build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index ff96a67..e7974b5 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -50,7 +50,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64 + platforms: ${{ matrix.platform }} file: ${{ format('./{0}/Dockerfile', matrix.ghc-version) }} push: false # ${{ github.ref == 'refs/heads/master' }} tags: ${{ format('{0}:{1}', env.IMAGE_NAME, matrix.ghc-version) }} From dc0a7a18e926976efe410c7dcffa42c451a5a408 Mon Sep 17 00:00:00 2001 From: Christopher Sasarak Date: Tue, 20 Aug 2024 11:30:04 -0500 Subject: [PATCH 10/10] Cleanup. --- .github/workflows/build-docker.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index e7974b5..e38a0f7 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -37,9 +37,6 @@ jobs: - uses: actions/checkout@v2 - # - name: Build image - # run: docker build ./${{ matrix.ghc-version }} --platform ${{ matrix.platform }} --tag $IMAGE_NAME:${{ matrix.ghc-version }} - - name: Login to Docker Hub if: ${{ github.ref == 'refs/heads/master' }} uses: docker/login-action@v3 @@ -52,13 +49,5 @@ jobs: with: platforms: ${{ matrix.platform }} file: ${{ format('./{0}/Dockerfile', matrix.ghc-version) }} - push: false # ${{ github.ref == 'refs/heads/master' }} + push: ${{ github.ref == 'refs/heads/master' }} tags: ${{ format('{0}:{1}', env.IMAGE_NAME, matrix.ghc-version) }} - - # - name: Log into registry - # if: ${{ github.ref == 'refs/heads/master' }} - # run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u fossabot --password-stdin - - # - name: Push image - # if: ${{ github.ref == 'refs/heads/master' }} - # run: docker push $IMAGE_NAME:${{ matrix.ghc-version }}