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/)
6 Purescript build for docker
8 ![Purescript](https://raw.githubusercontent.com/Risto-Stevcev/purescript-docker/master/logo.png)
12 You can build the image locally by cloning the repo and running `docker build .` in the project root.
16 Note: You may need to run docker comands as a superuser (sudo) depending on how it's configured on your system.
18 Pull the version you want to use:
21 $ docker pull gyeh/purescript:0.9.1
24 Check to see that your image was created:
28 REPOSITORY TAG IMAGE ID CREATED SIZE
29 gyeh/purescript 0.9.1 b09608732ec8 0 minutes ago 831.9 MB
32 Try the Purescript REPL (you need to run it in interactive mode with a pseudo-teletype):
35 $ docker run --rm -it b09608732ec8
37 | _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_
38 | |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __|
39 | __/| |_| | | | __/___) | (__| | | | |_) | |_
40 |_| \__,_|_| \___|____/ \___|_| |_| .__/ \__|
55 To start doing real work with it, you need to mount a volume to your docker container when you run it.
56 Clone the [Purescript By Example](https://leanpub.com/purescript/read) code as an initial example:
59 $ git clone https://github.com/paf31/purescript-book
60 Cloning into 'purescript-book'...
61 Checking connectivity... done.
64 Then mount the volume using the absolute path of the cloned repo to the `/home/pureuser/src` folder in the container:
67 $ docker run --rm -itv ~/git/purescript/tmp/purescript-book/:/home/pureuser/src b09608732ec8 bash
68 pureuser@1ddb0b0ed568:~$ ls
70 pureuser@1ddb0b0ed568:~$ cd src/
71 pureuser@1ddb0b0ed568:~/src$ ls
72 CONTRIBUTING.md README.md chapter11 chapter13 chapter2 chapter4 chapter6 chapter8
73 LICENSE.md chapter10 chapter12 chapter14 chapter3 chapter5 chapter7 chapter9
74 pureuser@1ddb0b0ed568:~/src$ cd chapter3/
75 pureuser@1ddb0b0ed568:~/src/chapter3$ bower install
76 pureuser@1ddb0b0ed568:~/src/chapter3$ pulp build
79 It should have built successfully. You can also run the tests:
82 pureuser@1ddb0b0ed568:~/src/chapter3$ pulp test
86 Just ("Smith, John: 123 Fake St., Faketown, CA")
90 Since you mounted the volume, you can actually edit the code outside of the running docker instance and it will update inside the container!
92 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!
95 pureuser@1ddb0b0ed568:~/src/chapter3$ pulp test
99 Just ("Smith, John: 123 Foobar St., Faketown, CA")
103 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.