Run PureScript on a Docker container

Introduction

Docker Hub has some images of PureScript working, but the ones using Node.js v12 and spago I couldn't find it, so I created it myself

Verification environment

Windows10 Home Edition
VirtualBox 6.1.16
docker-machine.exe version 0.16.1, build cce350d7

# Docker Host OS (CoreOS)
$ uname -a
Linux default 4.14.154-boot2docker #1 SMP Thu Nov 14 19:19:08 UTC 2019 x86_64 GNU/Linux

Docker version 19.03.5, build 633a0ea838
docker-compose version 1.26.0, build d4451659

Directory structure

Only docker-compose.yml and Dockerfile in the purescript folder

purescript
|   docker-compose.yml
|   Dockerfile

docker-compose.yml

docker-compose.yml


version: "3.7"
services:
  purescript:
    build:
      context: .
      dockerfile: Dockerfile
    image: takaya030/purescript

Dockerfile

Dockerfile


FROM node:12
LABEL maintainer "takaya030"

# install purescript
RUN npm install --global --unsafe-perm purescript spago

# add user
RUN userdel node && \
	useradd -m -s /bin/bash pureuser

WORKDIR /home/pureuser
USER pureuser

RUN mkdir tmp && cd tmp && spago init

CMD cd tmp && spago repl

Build image

$ cd purescript
$ docker-compose build purescript

Check the image

$ docker images
REPOSITORY             TAG                 IMAGE ID            CREATED             SIZE
takaya030/purescript   latest              fb50aeb56d04        22 hours ago        1.08GB
node                   12                  1f560ce4ce7e        4 weeks ago         918MB

Operation check

$ docker-compose run --rm purescript

[info] Installing 4 dependencies.
[info] Searching for packages cache metadata..
[info] Unable to find packages cache metadata, downloading from GitHub..
[info] Installing and globally caching "psci-support"
[info] Installing and globally caching "console"
[info] Installing and globally caching "effect"
[info] Installing and globally caching "prelude"
[info] Installation complete.
Compiling Type.Data.RowList
Compiling Type.Data.Row
Compiling Record.Unsafe
  .
  .
  .
Compiling Main
Compiling PSCI.Support
Compiling Test.Main
PSCi, version 0.13.8
Type :? for help

import Prelude

> "hello"
"hello"

> 1 + 2 * 3
7

> import Effect.Console
> log "print this to the screen"
print this to the screen
unit

> :quit
See ya!
()

reference

-How to get started with PureScript, a pure functional scripting language-- Qiita

Recommended Posts

Run PureScript on a Docker container
Run React on a Docker container
Run GUI application on Docker container
Run NordVPN on Docker (Windows) Ubuntu container
Run phpunit on Docker
Run GUI application on Docker container (Japanese input)
I made a Docker container to run Maven
I tried running Ansible on a Docker container
Run openvpn on Docker (windows)
Run the Android emulator on Docker using Android Emulator Container Scripts
Run SSE (Server-Sent-Event) samples on docker
Steps to run docker on Mac
Run puppeteer-core on Heroku (Docker edition)
Run the AWS CLI on Docker
How to run JavaFX on Docker
I tried running a Docker container on AWS IoT Greengrass 2.0
Try Hello World using plain Java on a Docker container
[Microsoft] Run Azure Pipelines (VSTS) Agent on Docker or Azure Container Instance
I tried deploying a Docker container on Lambda with Serverless Framework
Run (provisionally) a Docker image with ShellCommandActivity on AWS Data Pipeline
Build a PureScript development environment with Docker
Run Embulk on Docker to convert files
Try building a GPU container on GCP.
Until you run apache on ubuntu on docker
Run Ubuntu + ROS with Docker on Mac
Liberty on Docker
Access MySQL on a Docker container from a local (host OS) Java program
Starting with installing Docker on EC2 and running Yellowfin in a container
Run x11 apps in a Docker container (supports network access from the container)
Small Docker container
Created a Docker container image for an OpenLDAP server based on Fedora
Redmine on Docker
How to deploy a container on AWS Lambda
Create a Lambda Container Image based on Java 15
How to get a heapdump from a Docker container
Build a Kotlin app using OpenJDK's Docker container
Build a container for Docker x Laravel phpMyAdmin
Update container image with KUSANAGI Runs on Docker
Docker Container pull has a rate limit enforced
Run autossh as a systemd service on CentOS
Create a Docker container for your development web server in Ansible on MacOS
Run STS4 on Mac
Systemctl cannot be used on Ubuntu inside Docker container
Create a Java (Gradle) project with VS Code and develop it on a Docker container
Docker installation on CentOS 6
Lambda on Terraform Container
python notes on docker
Test run on rails
Run Pico with docker
Run PostgreSQL on Java
Install Docker on Manjaro
Let's create a gcloud development environment on a centos8 container
Create a Docker container to convert EPS to PGF source
[Docker] How to update using a container on Heroku and how to deal with Migrate Error
GitHub Actions/Cache: Cache bundle installed gems on Docker container
Run Payara with Docker
[Docker] Build an Apache container on EC2 using dockerfile
A memorandum when installing Docker and building a Linux container
Proceed with the official Rust documentation on a Docker container (2. Program a number guessing game)
Docker container usage scene
Run Processing on Ant