|
| 1 | +FROM alpine:3.18 |
| 2 | +# Install deps for: |
| 3 | +# - ghc/cabal: curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz tar perl zlib-dev |
| 4 | +# - repo clone: git |
| 5 | +# - static builds: zlib-static HACK(broken-ghc-musl): ncurses-static |
| 6 | +# - random haskell libraries with cbits (basement): binutils-gold |
| 7 | +# - to use embedded binaries in development (ie themis): libc6-compat |
| 8 | +# - for nix installation via github action cachix/install-nix-action: sudo |
| 9 | +RUN apk --no-cache add binutils-gold curl gcc g++ git gmp-dev ncurses-dev ncurses-static libffi-dev make xz xz-static tar perl zlib-dev zlib-static bash sudo libc6-compat git-lfs |
| 10 | + |
| 11 | +# Install system deps for FOSSA CLI: |
| 12 | +RUN apk --no-cache add bash xz-libs xz-dev bzip2-dev bzip2-static upx curl jq |
| 13 | + |
| 14 | +ENV GHC_VERSION="9.8.4" |
| 15 | + |
| 16 | +ENV PATH="/root/.cabal/bin:/root/.ghcup/bin:$PATH" |
| 17 | + |
| 18 | +# There aren't official builds of ghcup that are built against musl for aarch64. |
| 19 | +# So the following two steps do the install manually on that platform. |
| 20 | +# They manually do the same steps that ghcup would. |
| 21 | +# ghcup should have support for this soon: https://github.com/haskell/ghcup-hs/issues/1012#issuecomment-2294829976 |
| 22 | +# When that happens, you should be able to remove the 'else' branches and have the install work for all platforms. |
| 23 | +RUN <<EOF |
| 24 | + export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 |
| 25 | + export BOOTSTRAP_HASKELL_MINIMAL=1 |
| 26 | + curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh |
| 27 | + |
| 28 | + ghcup install ghc "$GHC_VERSION" |
| 29 | + ghcup set ghc "$GHC_VERSION" |
| 30 | + |
| 31 | + # Docs take up a lot of space in the image and aren't really necessary. |
| 32 | + rm -rf "$HOME/.ghcup/share/doc" |
| 33 | +EOF |
| 34 | + |
| 35 | +# Install cabal |
| 36 | +RUN <<EOF |
| 37 | + ghcup install cabal 3.12.1.0 |
| 38 | +EOF |
| 39 | + |
| 40 | +# Sets USER environment to overcome issue, as described in: |
| 41 | +# https://github.com/cachix/install-nix-action/issues/122 |
| 42 | +ENV USER=guest |
0 commit comments