diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..21f32ac4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +.*.swp +.tags* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..4d56bf2d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:trusty + +ENV MONGODB_URI=mongodb://localhost:27017/cube_development \ + PORT=1080 \ + EVALUATOR_AUTHENTICATOR=allow_all \ + COLLECTOR_AUTHENTICATOR=allow_all + +RUN apt-get update && apt-get -qq -y install \ + python \ + python-bcrypt \ + npm \ + nodejs \ + nodejs-legacy \ + > /dev/null \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app +ADD ./ /app + +RUN npm install && npm update + +ENTRYPOINT ["node"] diff --git a/README.md b/README.md index 707e6bb5..a97eae2e 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,22 @@ **Cube** is a system for collecting timestamped events and deriving metrics. By collecting events rather than metrics, Cube lets you compute aggregate statistics *post hoc*. It also enables richer analysis, such as quantiles and histograms of arbitrary event sets. Cube is built on [MongoDB](http://www.mongodb.org) and available under the [Apache License](/square/cube/blob/master/LICENSE). Want to learn more? [See the wiki.](https://github.com/square/cube/wiki) + +## Docker + +This branch supports building cube into a docker container. The dependencies are included as parts of them are not available in npm repositories anymore. This allows to create a container with the command: + +`docker build -t cube .` + +The image can be configured by changing the default values of those environment variables: + +```bash +MONGODB_URI=mongodb://localhost:27017/cube_development +PORT=1080 +EVALUATOR_AUTHENTICATOR=allow_all +COLLECTOR_AUTHENTICATOR=allow_all +``` + +Finally the container can be started for example with: + +`docker run -p 1080:1080 -e MONGODB_URI=mongodb://mongodb:27017/cube cube bin/collector`