From ad39ded0ee979ba36438f783de41e27906b0336e Mon Sep 17 00:00:00 2001 From: Ben Einaudi Date: Mon, 2 Jan 2017 14:45:03 +0100 Subject: [PATCH] feat(server): Allow to be run in docker by providing a docker file --- .dockerignore | 5 +++++ Dockerfile | 17 +++++++++++++++++ README.md | 17 +++++++++++------ 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c71bc3f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules +.git +.idea +*.iml +*.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..85c7090 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM node:0.12 + +# Create app directory +RUN mkdir -p /opt/app-root/src +WORKDIR /opt/app-root/src + + +# Install app dependencies +COPY package.json /opt/app-root/src +RUN npm install + +# Bundle app source +COPY . /opt/app-root/src + +EXPOSE 8080 +CMD [ "npm", "start" ] + diff --git a/README.md b/README.md index 26f6319..5627c46 100644 --- a/README.md +++ b/README.md @@ -24,15 +24,20 @@ It couldn't be more simple (but you will need a running instance of just-drop-i ## How to run it -### on any computer -You will need both [npm](https://www.npmjs.com/) and [node.js](https://nodejs.org/) if you want to run it. - +### On any computer +#### With node JS +Download and install [node.js v0.10](https://nodejs.org/download/release/latest-v0.10.x/). Then: * Download the source code -* run `npm install` to download the needed dependencies -* `node server.js` will start node-js server +* Download the needed dependencies (first time only): `npm install` +* Start node-js server: `npm start` + +##### With docker +We provide our own docker image to deploy node js. +- Build the image (first time): `docker build -t just-drop-it .` (add `--build-arg HTTP_PROXY=http://proxy-host: --build-arg HTTPS_PROXY=proxy-host:` if you are running behind a proxy) +- Run the image (first time): `docker run --name just-drop-it -p 8080:8080 -d just-drop-it` (next time you will just have to start it with `docker start just-drop-it`) ### on an openshift instance -just-drop-it should work on [openshift] (http://openshift.redhat.com/) instances. Juste create a node-js 0.10 app and synchronize its git repository with our. +just-drop-it should work on [openshift2](http://openshift.redhat.com/) instances. Just create a node-js v0.10 app and synchronize its git repository with our. ## From a technical point of view More details on our implementation, to be updated.