aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRisto Stevcev <risto1@gmail.com>2016-06-27 04:52:05 +0200
committerRisto Stevcev <risto1@gmail.com>2016-06-27 04:52:05 +0200
commit999566011bf240b1cbc07d3d62823e83b9cb0f91 (patch)
treea94966bf2fd5048887c5d03efffc08e6f5a35e47
parent79c6723c6f830f8738bf98ae987a9878ae7d7ace (diff)
downloadpurescript-docker-999566011bf240b1cbc07d3d62823e83b9cb0f91.tar.gz
purescript-docker-999566011bf240b1cbc07d3d62823e83b9cb0f91.tar.zst
purescript-docker-999566011bf240b1cbc07d3d62823e83b9cb0f91.zip
Updated README
-rw-r--r--README.md91
1 files changed, 91 insertions, 0 deletions
diff --git a/README.md b/README.md
index 502b118..5fc2698 100644
--- a/README.md
+++ b/README.md
@@ -2,3 +2,94 @@
2Purescript build for docker :sail: 2Purescript build for docker :sail:
3 3
4![Purescript](https://raw.githubusercontent.com/Risto-Stevcev/purescript-docker/master/logo.png) 4![Purescript](https://raw.githubusercontent.com/Risto-Stevcev/purescript-docker/master/logo.png)
5
6# usage
7
8Note: You may need to run docker comands as a superuser (sudo) depending on how it's configured on your system.
9
10Pull the version you want to use:
11
12```
13$ docker pull gyeh/purescript:0.8.5
14```
15
16Check to see that your image was created:
17
18```
19$ docker images
20REPOSITORY TAG IMAGE ID CREATED SIZE
21gyeh/purescript 0.8.5 b09608732ec8 0 minutes ago 829.8 MB
22```
23
24Try the Purescript REPL (you need to run it in interactive mode with a pseudo-teletype):
25
26```
27$ docker run --rm -it b09608732ec8
28 ____ ____ _ _
29| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_
30| |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __|
31| __/| |_| | | | __/___) | (__| | | | |_) | |_
32|_| \__,_|_| \___|____/ \___|_| |_| .__/ \__|
33 |_|
34
35:? shows help
36> import Prelude
37> 2 + 2
384
39
40> :t "Foo"
41String
42
43>
44See ya!
45```
46
47To start doing real work with it, you need to mount a volume to your docker container when you run it.
48Clone the [Purescript By Example](https://leanpub.com/purescript/read) code as an initial example:
49
50```
51$ git clone https://github.com/paf31/purescript-book
52Cloning into 'purescript-book'...
53Checking connectivity... done.
54```
55
56Then mount the volume using the absolute path of the cloned repo to the `/home/pureuser/src` folder in the container:
57
58```
59$ docker run --rm -itv ~/git/purescript/tmp/purescript-book/:/home/pureuser/src b09608732ec8 bash
60pureuser@1ddb0b0ed568:~$ ls
61src tmp
62pureuser@1ddb0b0ed568:~$ cd src/
63pureuser@1ddb0b0ed568:~/src$ ls
64CONTRIBUTING.md README.md chapter11 chapter13 chapter2 chapter4 chapter6 chapter8
65LICENSE.md chapter10 chapter12 chapter14 chapter3 chapter5 chapter7 chapter9
66pureuser@1ddb0b0ed568:~/src$ cd chapter3/
67pureuser@1ddb0b0ed568:~/src/chapter3$ bower install
68pureuser@1ddb0b0ed568:~/src/chapter3$ pulp build
69```
70
71It should have built successfully. Ignore the warnings -- as of the time of this writing the book hasn't been updated for 0.9.x module syntax that the compiler is mentioning will change. All examples should still build and work as expected. You can also run the tests:
72
73```
74pureuser@1ddb0b0ed568:~/src/chapter3$ pulp test
75* Build successful.
76* Running tests...
77Nothing
78Just ("Smith, John: 123 Fake St., Faketown, CA")
79* Tests OK.
80```
81
82Since you mounted the volume, you can actually edit the code outside of the running docker instance and it will update inside the container!
83
84Open 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!
85
86```
87pureuser@1ddb0b0ed568:~/src/chapter3$ pulp test
88* Build successful.
89* Running tests...
90Nothing
91Just ("Smith, John: 123 Foobar St., Faketown, CA")
92* Tests OK.
93```
94
95This 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.