]> git.immae.eu Git - github/fretlink/purescript-docker.git/blame - README.md
Updated logo
[github/fretlink/purescript-docker.git] / README.md
CommitLineData
649ea3a7 1# purescript-docker
fb6a7a8a
RS
2
3[![Docker Stars](https://img.shields.io/docker/stars/gyeh/purescript.svg?maxAge=2592000)](https://hub.docker.com/r/gyeh/purescript/)
4[![Docker Pulls](https://img.shields.io/docker/pulls/gyeh/purescript.svg?maxAge=2592000)](https://hub.docker.com/r/gyeh/purescript/)
5
6Purescript build for docker
79c6723c
RS
7
8![Purescript](https://raw.githubusercontent.com/Risto-Stevcev/purescript-docker/master/logo.png)
99956601
RS
9
10# usage
11
12Note: You may need to run docker comands as a superuser (sudo) depending on how it's configured on your system.
13
14Pull the version you want to use:
15
16```
fb6a7a8a 17$ docker pull gyeh/purescript:0.9.1
99956601
RS
18```
19
20Check to see that your image was created:
21
22```
23$ docker images
24REPOSITORY TAG IMAGE ID CREATED SIZE
fb6a7a8a 25gyeh/purescript 0.9.1 b09608732ec8 0 minutes ago 831.9 MB
99956601
RS
26```
27
28Try the Purescript REPL (you need to run it in interactive mode with a pseudo-teletype):
29
30```
31$ docker run --rm -it b09608732ec8
32 ____ ____ _ _
33| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_
34| |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __|
35| __/| |_| | | | __/___) | (__| | | | |_) | |_
36|_| \__,_|_| \___|____/ \___|_| |_| .__/ \__|
37 |_|
38
39:? shows help
40> import Prelude
41> 2 + 2
424
43
44> :t "Foo"
45String
46
47>
48See ya!
49```
50
51To start doing real work with it, you need to mount a volume to your docker container when you run it.
52Clone the [Purescript By Example](https://leanpub.com/purescript/read) code as an initial example:
53
54```
55$ git clone https://github.com/paf31/purescript-book
56Cloning into 'purescript-book'...
57Checking connectivity... done.
58```
59
60Then mount the volume using the absolute path of the cloned repo to the `/home/pureuser/src` folder in the container:
61
62```
63$ docker run --rm -itv ~/git/purescript/tmp/purescript-book/:/home/pureuser/src b09608732ec8 bash
64pureuser@1ddb0b0ed568:~$ ls
65src tmp
66pureuser@1ddb0b0ed568:~$ cd src/
67pureuser@1ddb0b0ed568:~/src$ ls
68CONTRIBUTING.md README.md chapter11 chapter13 chapter2 chapter4 chapter6 chapter8
69LICENSE.md chapter10 chapter12 chapter14 chapter3 chapter5 chapter7 chapter9
70pureuser@1ddb0b0ed568:~/src$ cd chapter3/
71pureuser@1ddb0b0ed568:~/src/chapter3$ bower install
72pureuser@1ddb0b0ed568:~/src/chapter3$ pulp build
73```
74
fb6a7a8a 75It should have built successfully. You can also run the tests:
99956601
RS
76
77```
78pureuser@1ddb0b0ed568:~/src/chapter3$ pulp test
79* Build successful.
80* Running tests...
81Nothing
82Just ("Smith, John: 123 Fake St., Faketown, CA")
83* Tests OK.
84```
85
86Since you mounted the volume, you can actually edit the code outside of the running docker instance and it will update inside the container!
87
88Open up `chapter3/test/Main.purs` using your favorite editor, and update `example.address.street` in the `example` record to `"123 Foobar St."`. Now rerun the tests, and you'll see that it updated!
89
90```
91pureuser@1ddb0b0ed568:~/src/chapter3$ pulp test
92* Build successful.
93* Running tests...
94Nothing
95Just ("Smith, John: 123 Foobar St., Faketown, CA")
96* Tests OK.
97```
98
99This docker image creates a user called `pureuser` that it logs in as so that `bower` and `pulp` don't yell at you. If you want to add more stuff as you go along, switch to the superuser (`su`), or add pureuser to sudoers.