はじめに
Docker Hub に PureScript
が動作するイメージがいくつかアップされていますが、 Node.js v12
かつ spago
を使用しているものが見当たらなかったので自分で作成してみました
検証環境
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
ディレクトリ構成
purescript
フォルダの中に docker-compose.yml
と Dockerfile
のみ
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
イメージのビルド
$ cd purescript
$ docker-compose build purescript
イメージの確認
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
takaya030/purescript latest fb50aeb56d04 22 hours ago 1.08GB
node 12 1f560ce4ce7e 4 weeks ago 918MB
動作確認
$ 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!
()