Skip to content

Commit

Permalink
Move Docker out into the site
Browse files Browse the repository at this point in the history
  • Loading branch information
ediblecode committed Nov 18, 2016
1 parent 9cd044a commit e2b42b0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 151 deletions.
37 changes: 0 additions & 37 deletions Dockerfile

This file was deleted.

53 changes: 4 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ Welcome to NICE Experience. Your source for creating beautiful, consistent exper
- [Project structure](#project-structure)
- [Prerequisites](#prerequisites)
- [Development](#development)
- [Option 1: Docker](#option-1-docker)
- [Troubleshooting](#docker-troubleshooting)
- [Option 2: npm/Grunt](#option-2-npmgrunt)
- [npm/Grunt](#npmgrunt)
- [Grunt](#grunt)
- [npm](#npm)
- [Node](#node)
Expand Down Expand Up @@ -77,55 +75,13 @@ See https://www.nice.org.uk/accessibility for more information.

## Prerequisites

You can either run the app directly on your machine with Node OR via Docker if you prefer. So, pre-requisites are:
We use Grunt for running tasks so the only prerequisites are:

- [Node 6+](https://nodejs.org/en/download/) (with npm 3.9)

OR

- [Docker](https://docs.docker.com/)
- Docker's dependencies e.g. [VirtualBox](https://www.virtualbox.org/)

## Development

You can either run the app in development through [Docker](#option-1-docker) or via [Grunt](#option-2-grunt) (via Node) directly on your machine.

### Option 1: Docker

Before running Docker commands, you will need to make sure of 2 things:

- If running Docker through VirtualBox, your source code must be in your Users directory. VB only shares the users directory by default. Or you can add your code directory manually via the VB GUI.
- Enable sharing your C drive (or whichever drive you code is in) via the Docker GUI.

If you have Docker installed, then running:

`./docker-dev.sh`

from a shell is enough to:

1. build our custom image (named 'experience') if it hasn't been built already
2. share a volume of the app's code for development
3. run the container (named 'experience'), exposing necessary ports
- *12345* (mapped to 54321 inside) for the web app
- *35729* for livereload
4. run `grunt watch` inside the container
5. opens http://localhost:12345 on the host to browse to the web app

This means you can run the solution without having to get the correct version Node, install global grunt etc. It will be slow the first time as it downloads the image and gets dependencies but Docker caches everything so will be quicker on subsequent runs.

Once the Docker container is running you can treat it like any other Docker container, e.g.

`winpty docker exec -it experience ash`

to attach a command prompt. Not use of *ash* not *bash* as we're using Alpine.

#### Docker troubleshooting

**A valid Gruntfile could not be found**

Is your source code shared with VB? Is your C drive shared with Docker? Have a look at https://blogs.msdn.microsoft.com/stevelasker/2016/06/14/configuring-docker-for-windows-volumes/ if you're still struggling with credentials for shared folders on Windows.

### Option 2: npm/Grunt
### npm/Grunt

TL;DR:
1. `npm i -g grunt-cli`
Expand Down Expand Up @@ -153,7 +109,7 @@ Before you run any tasks, you'll have to run the following from the command line
| `grunt` | Default. Lints, builds everything in parallel and runs an express server and a watch task for dev changes. Prefer to use `npm start` instead. |
| `grunt lint` | Lints SASS and JS |
| `grunt test` | Runs JS tests |
| `grunt dist` | Builds documentation, modernizr, CSS and JS in production mode (minified etc). Fro deploying the web app itself. |
| `grunt dist` | Builds documentation, modernizr, CSS and JS in production mode (minified etc). For deploying the web app itself. |
| `grunt prepublish` | Builds minified code for publishing to npm etc |

#### npm
Expand All @@ -167,7 +123,6 @@ Run `npm start` and `npm run test:watch` for development.
| `npm run test:watch` | Runs JS test tests (with [min reporter](https://github.com/mochajs/mocha/blob/master/lib/reporters/min.js)) and watches for changes. Useful to run in development alongside grunt. |
| `npm run test:coverage` | Runs JS test tests and generates a coverage report with [Istanbul](https://istanbul.js.org/) into the *coverage* folder |
| `npm run lint` | Lints SASS and JS (uses `grunt lint` under the hood) |
| `npm run serve` | Spins up an express server through Node directly (NOT via Grunt) on port *54321* |

#### Node

Expand Down
65 changes: 0 additions & 65 deletions docker-dev.sh

This file was deleted.

0 comments on commit e2b42b0

Please sign in to comment.