diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index c996f1e..e38a0f7 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -14,23 +14,40 @@ 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: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Build image - run: docker build ./${{ matrix.ghc-version }} --tag $IMAGE_NAME:${{ matrix.ghc-version }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Log into registry - run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u fossabot --password-stdin + - uses: actions/checkout@v2 - - name: Push image + - name: Login to Docker Hub if: ${{ github.ref == 'refs/heads/master' }} - run: docker push $IMAGE_NAME:${{ matrix.ghc-version }} + uses: docker/login-action@v3 + with: + username: fossabot + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: ${{ matrix.platform }} + file: ${{ format('./{0}/Dockerfile', matrix.ghc-version) }} + push: ${{ github.ref == 'refs/heads/master' }} + tags: ${{ format('{0}:{1}', env.IMAGE_NAME, matrix.ghc-version) }} diff --git a/ghc-9.8.2/Dockerfile b/ghc-9.8.2/Dockerfile index 940df3c..e112355 100644 --- a/ghc-9.8.2/Dockerfile +++ b/ghc-9.8.2/Dockerfile @@ -11,16 +11,45 @@ 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 -# Delete the documentation, we don't really need it. -RUN ghcup install ghc 9.8.2 && rm -rf "$HOME/.ghcup/share/doc/*" +# 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 <