From 105cd287d23b233b048da3b1bb12fc915216fc43 Mon Sep 17 00:00:00 2001 From: Dominick Gendill Date: Fri, 20 Jan 2017 15:20:07 -0700 Subject: Added Dockerfile. Upgraded to purescript 0.10.5. --- Dockerfile | 26 ++++++++++++++++++++++++++ README.md | 18 +++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..88b1b8c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM node:4 + +MAINTAINER Risto Stevcev + +ENV PURESCRIPT_DOWNLOAD_SHA1 8355acb4419fcd136d7f8d19d398ae8ebf457bcd + +RUN npm install -g bower pulp@10.0.0 + +RUN cd /opt \ + && wget https://github.com/purescript/purescript/releases/download/v0.10.5/linux64.tar.gz \ + && echo "$PURESCRIPT_DOWNLOAD_SHA1 linux64.tar.gz" | sha1sum -c - \ + && tar -xvf linux64.tar.gz \ + && rm /opt/linux64.tar.gz + +ENV PATH /opt/purescript:$PATH + +RUN userdel node +RUN useradd -m -s /bin/bash pureuser + +WORKDIR /home/pureuser + +USER pureuser + +RUN mkdir tmp && cd tmp && pulp init + +CMD cd tmp && pulp psci diff --git a/README.md b/README.md index f75320c..5f018e5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,11 @@ Purescript build for docker ![Purescript](https://raw.githubusercontent.com/Risto-Stevcev/purescript-docker/master/logo.png) -# usage +# Build Locally + +You can build the image locally by cloning the repo and running `docker build .` in the project root. + +# Usage Note: You may need to run docker comands as a superuser (sudo) depending on how it's configured on your system. @@ -17,7 +21,7 @@ Pull the version you want to use: $ docker pull gyeh/purescript:0.9.1 ``` -Check to see that your image was created: +Check to see that your image was created: ``` $ docker images @@ -30,9 +34,9 @@ Try the Purescript REPL (you need to run it in interactive mode with a pseudo-te ``` $ docker run --rm -it b09608732ec8 ____ ____ _ _ -| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_ +| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_ | |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __| -| __/| |_| | | | __/___) | (__| | | | |_) | |_ +| __/| |_| | | | __/___) | (__| | | | |_) | |_ |_| \__,_|_| \___|____/ \___|_| |_| .__/ \__| |_| @@ -44,11 +48,11 @@ $ docker run --rm -it b09608732ec8 > :t "Foo" String -> +> See ya! ``` -To start doing real work with it, you need to mount a volume to your docker container when you run it. +To start doing real work with it, you need to mount a volume to your docker container when you run it. Clone the [Purescript By Example](https://leanpub.com/purescript/read) code as an initial example: ``` @@ -85,7 +89,7 @@ Just ("Smith, John: 123 Fake St., Faketown, CA") Since you mounted the volume, you can actually edit the code outside of the running docker instance and it will update inside the container! -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! +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! ``` pureuser@1ddb0b0ed568:~/src/chapter3$ pulp test -- cgit v1.2.3