diff options
author | Risto Stevcev <risto1@gmail.com> | 2016-06-27 06:03:39 +0200 |
---|---|---|
committer | Risto Stevcev <risto1@gmail.com> | 2016-06-27 06:03:39 +0200 |
commit | 4b6f17962d7626a401f0a68dc7dc1d1524a79d4d (patch) | |
tree | afa11d0f14024db9a33d26286c21864c4a894948 /README.md | |
parent | c385b7552e19a668ba86412367e4b4041c43917e (diff) | |
download | purescript-docker-4b6f17962d7626a401f0a68dc7dc1d1524a79d4d.tar.gz purescript-docker-4b6f17962d7626a401f0a68dc7dc1d1524a79d4d.tar.zst purescript-docker-4b6f17962d7626a401f0a68dc7dc1d1524a79d4d.zip |
Updated README
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 93 |
1 files changed, 93 insertions, 0 deletions
@@ -1,2 +1,95 @@ | |||
1 | # purescript-docker | 1 | # purescript-docker |
2 | Purescript build for docker :sail: | 2 | Purescript build for docker :sail: |
3 | |||
4 | ![Purescript](https://raw.githubusercontent.com/Risto-Stevcev/purescript-docker/master/logo.png) | ||
5 | |||
6 | # usage | ||
7 | |||
8 | Note: You may need to run docker comands as a superuser (sudo) depending on how it's configured on your system. | ||
9 | |||
10 | Pull the version you want to use: | ||
11 | |||
12 | ``` | ||
13 | $ docker pull gyeh/purescript:0.8.5 | ||
14 | ``` | ||
15 | |||
16 | Check to see that your image was created: | ||
17 | |||
18 | ``` | ||
19 | $ docker images | ||
20 | REPOSITORY TAG IMAGE ID CREATED SIZE | ||
21 | gyeh/purescript 0.8.5 b09608732ec8 0 minutes ago 829.8 MB | ||
22 | ``` | ||
23 | |||
24 | Try 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 | ||
38 | 4 | ||
39 | |||
40 | > :t "Foo" | ||
41 | String | ||
42 | |||
43 | > | ||
44 | See ya! | ||
45 | ``` | ||
46 | |||
47 | To start doing real work with it, you need to mount a volume to your docker container when you run it. | ||
48 | Clone 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 | ||
52 | Cloning into 'purescript-book'... | ||
53 | Checking connectivity... done. | ||
54 | ``` | ||
55 | |||
56 | Then 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 | ||
60 | pureuser@1ddb0b0ed568:~$ ls | ||
61 | src tmp | ||
62 | pureuser@1ddb0b0ed568:~$ cd src/ | ||
63 | pureuser@1ddb0b0ed568:~/src$ ls | ||
64 | CONTRIBUTING.md README.md chapter11 chapter13 chapter2 chapter4 chapter6 chapter8 | ||
65 | LICENSE.md chapter10 chapter12 chapter14 chapter3 chapter5 chapter7 chapter9 | ||
66 | pureuser@1ddb0b0ed568:~/src$ cd chapter3/ | ||
67 | pureuser@1ddb0b0ed568:~/src/chapter3$ bower install | ||
68 | pureuser@1ddb0b0ed568:~/src/chapter3$ pulp build | ||
69 | ``` | ||
70 | |||
71 | It 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 | ``` | ||
74 | pureuser@1ddb0b0ed568:~/src/chapter3$ pulp test | ||
75 | * Build successful. | ||
76 | * Running tests... | ||
77 | Nothing | ||
78 | Just ("Smith, John: 123 Fake St., Faketown, CA") | ||
79 | * Tests OK. | ||
80 | ``` | ||
81 | |||
82 | Since you mounted the volume, you can actually edit the code outside of the running docker instance and it will update inside the container! | ||
83 | |||
84 | Open 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 | ``` | ||
87 | pureuser@1ddb0b0ed568:~/src/chapter3$ pulp test | ||
88 | * Build successful. | ||
89 | * Running tests... | ||
90 | Nothing | ||
91 | Just ("Smith, John: 123 Foobar St., Faketown, CA") | ||
92 | * Tests OK. | ||
93 | ``` | ||
94 | |||
95 | This 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. | ||