Purescript builds in Docker for ARM64 (for running on Apple M1)

Hi, I am new to Purescript (and linux) and haven’t found an answer to the above, beyond “compile from source”, which I am happy to try, but may need some help. Has anyone successfully managed to get Purescript (I believe its actually its GHC dependencies) running on an Arm 64 linux docker instance. I cant find anything on docker Hub, or one for Haskell toolchain on Arm64. I believe that other people will need this as development inside docker instances (I am using VSCode dev containers) has great isolation advantages and reproducible dev setups. Non-arm docker instances are suuuuper slow on all the new M1 macs as they run under emulation. I am happy to start working through creating a Dockerfile if this hasn’t been done before so long as there is nothing that obviously prohibits this working? Any guidance would be greatly appreciated.

1 Like

I got it compiled on Apple Silicon using @i-am-the-slime ‘s instruction: How to build an Apple Silicon version of the PureScript compiler · GitHub
You might have a look at this, not sure if you need to do anything else to compile it within the linux container.

1 Like

Thanks that was useful, I used this as a base. I managed a working image on Ubuntu. It’s a bit big at the moment. I need to split the docker build up and just extract the artifacts. But the following works:

FROM arm64v8/ubuntu:20.10
RUN apt update && apt upgrade -y
RUN apt install build-essential libnuma1 libnuma-dev libtinfo-dev libtinfo5 libtinfo6 libc6-dev -y
RUN apt install git curl libffi-dev libffi8ubuntu1 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 -y
RUN apt install llvm* -y
RUN apt install clang ninja-build -y
RUN apt install zlib1g-dev
RUN apt install haskell-stack -y
RUN apt install language-pack-en -y
RUN stack update
RUN git clone https://github.com/purescript/purescript.git
RUN cd purescript; stack install
RUN git clone https://github.com/purescript/spago.git
RUN cd spago; make install

Its available at jamesjwood/purescript-arm64