Docker

A docker file is provided in the demo-ps Purerl project that will allow for the building and execution of the project.

This is not by any means a “best practises” Docker development environment, I don’t actually have a clue what a “best practises” Docker development environment would look like but I know this is not it (It’s massive, for a start). This has been thrown together to make it easy to run the demo_ps project without having to manually install the tools required which has got to be a good thing.

This is definitely a good starting point for learning what tools are needed for a development environment and where to get them from (replace linux with macos in those download URLs and you’re pretty good to go, binaries are available for most platforms across these projects)

Pull requests happily accepted if anybody wants to replace the docker workflow/files with something a little more appropriate.

FROM ubuntu:20.10

# Sigh
RUN apt update

# Erlang 22-3
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y git bash erlang curl build-essential

RUN groupadd --gid 1000 dev \
  && useradd --uid 1000 --gid dev --shell /bin/bash --create-home dev

# Rebar3
RUN cd  /opt/ \
  && curl https://rebar3.s3.amazonaws.com/rebar3 > /usr/local/bin/rebar3 \
  && chmod +x /usr/local/bin/rebar3 

# Purescript 
RUN cd /opt/ \
    && curl -L https://github.com/purescript/purescript/releases/download/v0.14.4/linux64.tar.gz > purescript.tar.gz \
    && tar -xvf purescript.tar.gz \
    && cp purescript/purs /usr/local/bin/purs  \
    && rm purescript.tar.gz

# Purerl
RUN cd /opt/ \
    && curl -L https://github.com/purerl/purerl/releases/download/v0.0.12/linux64.tar.gz > purerl.tar.gz \
    && tar -xvf purerl.tar.gz \
    && cp purerl/purerl /usr/local/bin/purerl  \
    && rm purerl.tar.gz

# Spago
RUN cd /opt/ \
    && curl -L https://github.com/purescript/spago/releases/download/0.20.3/linux.tar.gz > spago.tar.gz \
    && tar -xvf spago.tar.gz \
    && cp spago /usr/local/bin/spago  \
    && rm spago.tar.gz

# Dhall
RUN cd /opt/ \
    && curl -L https://github.com/dhall-lang/dhall-haskell/releases/download/1.33.1/dhall-1.33.1-x86_64-linux.tar.bz2 > dhall-json.tar.bz2 \
    && tar -xjvf dhall-json.tar.bz2 \
    && cp bin/dhall /usr/local/bin/dhall  \
    && rm dhall-json.tar.bz2

For convenience, the scripts ./build_docker_image.sh and ./run_docker_image.sh are provided, the project can be built therefore with

# Build the actual docker image
./build_docker_image.sh

# Compile the project
./run_docker_image.sh rebar3 compile

# Build a release
./run_docker_image.sh rebar3 release

# Run the whole shebang
./run