From 77baaa5121bf6c8b4c7833ade337e9cc579b8e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Sat, 18 Jun 2016 01:11:49 +0200 Subject: [PATCH] Introduce unleash-docker as a sperate submodule. (#136) * Introduce unleash-docker as a sperate submodule. this is related to #135 and will solve #126 * keep ide-user-settings out of repo * Introduce unleash-docker as a sperate submodule. this is related to #135 and will solve #126 * mv unleash-docker to packages/unleash-docker * made docker work for now, by copying migrations * minro cleanup * docker on node:6 * minor cleanup --- .gitignore | 1 - Dockerfile | 10 ---------- README.md | 2 ++ .../unleash-docker/.dockerignore | 2 +- packages/unleash-docker/Dockerfile | 11 +++++++++++ .../unleash-docker/docker-compose.yml | 2 +- packages/unleash-docker/index.js | 3 +++ packages/unleash-docker/package.json | 18 ++++++++++++++++++ 8 files changed, 36 insertions(+), 13 deletions(-) delete mode 100644 Dockerfile rename .dockerignore => packages/unleash-docker/.dockerignore (64%) create mode 100644 packages/unleash-docker/Dockerfile rename docker-compose.yml => packages/unleash-docker/docker-compose.yml (82%) create mode 100644 packages/unleash-docker/index.js create mode 100644 packages/unleash-docker/package.json diff --git a/.gitignore b/.gitignore index d449957665..d76c7118eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ node_modules .DS_Store -.vscode # Logs logs diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index f916eb2c26..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM node:5.8 - -COPY . . - -RUN npm install --production && \ - npm run build - -EXPOSE 4242 - -CMD node server.js diff --git a/README.md b/README.md index aa215a4335..4611c55d74 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Known client implementations: We have set up docker-compose to start postgres and the unleash server together. This makes it really fast to start up unleash locally without setting up a database or node. +You find the docker files inside the `packages/unleash-docker` folder + ```bash $ docker-compose build $ docker-compose up diff --git a/.dockerignore b/packages/unleash-docker/.dockerignore similarity index 64% rename from .dockerignore rename to packages/unleash-docker/.dockerignore index e61253b7e3..3eabbdc038 100644 --- a/.dockerignore +++ b/packages/unleash-docker/.dockerignore @@ -1,3 +1,3 @@ .git docker-compose.yml -node_modules +node_modules \ No newline at end of file diff --git a/packages/unleash-docker/Dockerfile b/packages/unleash-docker/Dockerfile new file mode 100644 index 0000000000..4d33a539e5 --- /dev/null +++ b/packages/unleash-docker/Dockerfile @@ -0,0 +1,11 @@ +FROM nodesource/wheezy:6 + +COPY . . + +RUN npm install --production +RUN mkdir scripts && cp node_modules/unleash-server/scripts/migration-runner.js scripts/. && \ + mkdir migrations && cp -r node_modules/unleash-server/migrations/* migrations/. + +EXPOSE 4242 + +CMD node index.js diff --git a/docker-compose.yml b/packages/unleash-docker/docker-compose.yml similarity index 82% rename from docker-compose.yml rename to packages/unleash-docker/docker-compose.yml index 685f755d85..635f8ea3ba 100644 --- a/docker-compose.yml +++ b/packages/unleash-docker/docker-compose.yml @@ -1,6 +1,6 @@ web: build: . - command: npm run db-migrate-and-start + command: npm run migrate-and-start ports: - "4242:4242" links: diff --git a/packages/unleash-docker/index.js b/packages/unleash-docker/index.js new file mode 100644 index 0000000000..ef48ba7eda --- /dev/null +++ b/packages/unleash-docker/index.js @@ -0,0 +1,3 @@ +'use strict'; +var unleash = require('unleash-server'); +unleash.start({}); diff --git a/packages/unleash-docker/package.json b/packages/unleash-docker/package.json new file mode 100644 index 0000000000..1eeb9e883f --- /dev/null +++ b/packages/unleash-docker/package.json @@ -0,0 +1,18 @@ +{ + "name": "unleash-docker", + "version": "1.0.0", + "description": "Docker images for unleash.", + "main": "index.js", + "scripts": { + "start": "NODE_ENV=production node index.js", + "migrate-and-start": "npm run db-migrate && npm run start", + "db-migrate": "db-migrate up" + }, + "author": "", + "license": "ISC", + "dependencies": { + "db-migrate": "0.9.25", + "mkdirp": "^0.5.1", + "unleash-server": "^1.0.0-alpha.2" + } +}