From 93ce4e0189c0da5d699ebcaa59c9bcfa07831c71 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Thu, 14 Nov 2019 22:20:28 -0500 Subject: [PATCH] Technical/issue 229 docker documentation for local development (#255) * working * documentation * notes about testing * grammar * grammar --- .github/CONTRIBUTING.md | 23 ++++++++++++++++++++++- Dockerfile | 9 +++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c74c6e62c..69ec2d407 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -108,4 +108,25 @@ To test from a VM, you can You can disable plugins in _webpack.config.prod.js_ to remove production optimizations for testing purposes. -> Note: `yarn develop` does not work right now with IE11 and Edge. \ No newline at end of file +> Note: `yarn develop` does not work right now with IE11 and Edge. + +## Docker +A Docker container is available within the project to use as a development environment if you like. It is configured to use the same image that runs as part of the project's [Continuous Integration environment](https://github.com/ProjectEvergreen/greenwood/blob/master/.github/workflows/ci.yml#L9). + +First make sure you have [Docker installed](https://www.docker.com/products/docker-desktop). + +Then from the root of this repository do the following: +1. Build the container: `$ docker build -t nodejs-dev .` +1. Connect to the container: `$ docker run --name greenwood -v $(pwd):/workspace -i -t nodejs-dev` +1. Now you can run all the usual commands, e.g. + - `$ yarn install` + - `$ yarn build` + - `$ yarn test` + +> _This will create a 2 way binding between your host and the container, so file changes will go both ways between the [host and container](https://gist.github.com/falvarez/71298b07603d32374ceb2845c3eec997)._ + +When you're done with the container: +1. Exit the container: `$ exit` +1. Destroy the container: `$ docker rm greenwood` + +Note: If you have issues running tests due to timeouts, you can increase the setting in [package.json](https://github.com/ProjectEvergreen/greenwood/blob/master/package.json#L23) \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..4ad6e5225 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +# See the Contributing.md guide for more information on using this +# https://github.com/ProjectEvergreen/greenwood/blob/master/.github/CONTRIBUTING.md#docker + +FROM thegreenhouse/nodejs-dev:0.4.0 + +# Set the working directory to /workspace when starting the container +WORKDIR /workspace + +RUN yarn install \ No newline at end of file