From e43cbe9a5a8c1acc7e418a0a26378a5ea4583291 Mon Sep 17 00:00:00 2001 From: Paul Cadman Date: Thu, 10 Aug 2023 12:36:05 +0100 Subject: [PATCH] Use glcr.b-data.ch/ghc/ghc-musl for static build --- .github/workflows/linux-static-binary.yaml | 18 ++++++-- docker/Dockerfile-ghc-alpine | 34 --------------- docker/README.md | 48 ---------------------- 3 files changed, 15 insertions(+), 85 deletions(-) delete mode 100644 docker/Dockerfile-ghc-alpine delete mode 100644 docker/README.md diff --git a/.github/workflows/linux-static-binary.yaml b/.github/workflows/linux-static-binary.yaml index 4f6447d289..2484705fff 100644 --- a/.github/workflows/linux-static-binary.yaml +++ b/.github/workflows/linux-static-binary.yaml @@ -8,11 +8,14 @@ on: required: true default: "main" +env: + STACK_VERSION: 2.22.1 + jobs: build: name: Build static binary runs-on: ubuntu-latest - container: ghcr.io/paulcadman/ghc-alpine:9.2.7 + container: glcr.b-data.ch/ghc/ghc-musl:9.4.5 steps: - name: checkout code uses: actions/checkout@v3 @@ -28,14 +31,23 @@ jobs: run: echo "$HOME/.local/bin" >> $GITHUB_PATH shell: bash + - name: install stack + run: | + curl https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/stack-$STACK_VERSION-linux-x86_64-static.tar.gz -OL + tar xf stack-STACK_VERSION-linux-x86_64-static.tar.gz + cp stack-STACK_VERSION-linux-x86_64-static/stack /usr/local/bin + - name: Stack permissions bug workaround run: "chown -R $(id -un):$(id -gn) ~" + - name: Install clang14 + run: apk add --update clang14 + - name: Runtime build - run: make runtime + run: make runtime LIBTOOL=llvm14-ar - name: build Juvix - run: stack install --allow-different-user --system-ghc --ghc-options='-split-sections -optl-static' + run: stack install --allow-different-user --system-ghc --ghc-options='-split-sections' --flag juvix:static - run: echo "HOME=$HOME" >> $GITHUB_ENV shell: bash diff --git a/docker/Dockerfile-ghc-alpine b/docker/Dockerfile-ghc-alpine deleted file mode 100644 index a020a42d7f..0000000000 --- a/docker/Dockerfile-ghc-alpine +++ /dev/null @@ -1,34 +0,0 @@ -FROM alpine:3.16 -ARG GHC_BOOTSTRAP_VERSION=9.0.2 -ARG GHC_VERSION=9.4.5 -ARG STACK_VERSION=2.11.1 -ARG GHC_ALPINE_VERSION=3.12 - -RUN apk upgrade --no-cache &&\ - apk add --no-cache curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz gzip tar perl git bash sudo binutils-gold lld &&\ - apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static xz alex happy python3 - -RUN curl https://downloads.haskell.org/~ghc/$GHC_BOOTSTRAP_VERSION/ghc-$GHC_BOOTSTRAP_VERSION-x86_64-alpine$GHC_ALPINE_VERSION-linux-gmp.tar.xz -OL - -RUN tar xf ghc-$GHC_BOOTSTRAP_VERSION-x86_64-alpine$GHC_ALPINE_VERSION-linux-gmp.tar.xz - -RUN cd ghc-$GHC_BOOTSTRAP_VERSION-x86_64-unknown-linux && ./configure --prefix /opt && make install - -RUN curl https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-src.tar.xz -OL - -RUN tar xf ghc-$GHC_VERSION-src.tar.xz - -WORKDIR /ghc-$GHC_VERSION - -RUN GHC=/opt/bin/ghc ./configure --prefix /usr/local - -RUN make -j -RUN make install - -RUN apk add --no-cache clang llvm - -WORKDIR / - -RUN curl https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/stack-$STACK_VERSION-linux-x86_64.tar.gz -OL -RUN tar xf stack-$STACK_VERSION-linux-x86_64.tar.gz -RUN cp stack-$STACK_VERSION-linux-x86_64/stack /usr/local/bin diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index 68c74be6f6..0000000000 --- a/docker/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# The GHC alpine image - -We need this image to workaround an issue with the official GHC alpine binary, -see https://gitlab.haskell.org/ghc/ghc/-/issues/20266 - -We use this image to make static linux binaries. - -## Building the image - -Update the `ARGS` delcarations at the top of the [Dockerfile](./Dockerfile-ghc-alpine) to match the GHC version you're building for. - -The tag of the image should be prefixed by the location of the GitHub docker -repository that you're pushing to. In this case the repository is ` -ghcr.io/paulcadman`. - -```shell -docker build -t ghcr.io/paulcadman/ghc-alpine:9.2.7 -f Dockerfile-ghc-alpine-9.2.7 . -``` - -## Authenticating with the GitHub Docker repository - -First create a classic personal access token with `repo` and `write:packages` -permissions. - -Consult the GitHub documentation on how to do this: - -https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry - -Set the token to the variable `CR_PAT` and then authenticate: - -```shell -echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin -``` - -NB: You do not substitue your username for `USERNAME` in the command above. - -## Testing the image - -```shell -docker run -it --rm ghcr.io/paulcadman/ghc-alpine:9.2.7 -``` - -## Pushing the image - -```shell -docker push ghcr.io/paulcadman/ghc-alpine:9.2.7 - -```