Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Add Docker Support, closes #68 #69

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Modified Brett Fisher's node-docker-good-defaults https://github.com/BretFisher/node-docker-good-defaults/blob/master/Dockerfile
FROM thegreenhouse/nodejs-dev:0.4.0

# set our node environment, either development or production
# defaults to production, compose overrides this to development on build and run
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

# default to port 8000 for node, and 9229 and 9230 (tests) for debug
ARG PORT=8000
ENV PORT $PORT
EXPOSE $PORT 9229 9230

RUN npm i npm@latest -g

# install dependencies first, in a different location for easier app bind mounting for local development
WORKDIR /opt
COPY package.json package-lock.json* ./
RUN npm install && \
npm install --only=dev && \
npm cache clean --force
ENV PATH /opt/node_modules/.bin:$PATH

WORKDIR /opt/app
COPY . /opt/app
RUN echo "node_modules" > .eslintignore

RUN npm run build

# use `docker run --init in production`
# so that signals are passed properly.
CMD [ "ws" ]
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,30 @@ For convenience, Create Evergreen App comes with the dependencies needed to run
- For information on adding more browsers, see [the Karma docs](http://karma-runner.github.io/3.0/config/browsers.html).
- For more information on testing in general, see [our wiki!](https://github.com/ProjectEvergreen/create-evergreen-app/wiki).

> Chrome headless is enabled by default since it is the most portable between local and continuous integration environments.
> Chrome headless is enabled by default since it is the most portable between local and continuous integration environments.

#### Docker

Create Evergreen App comes Docker-ready with a built in Dockerfile

To build and tag a docker image with any image/release name for your app:

```bash
$ docker build -t imagename:releasename .
```

To run the docker image:

```bash
$ docker run --init imagename:releasename
```

You can access the app in your browser at http://172.17.0.2:8000 (your container's IP at port 8000)

**Note** Use the `--init` flag so that the signals are passed correctly.

To test the docker image:

```bash
$ docker run --init imagename:releasename npm run test
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
".editorconfig",
".eslintrc",
".gitattributes",
"Dockerfile",
"yarn.lock",
"package-lock.json",
"babel.config.js",
Expand Down