From d9591c57aa2839e77709871a34f7d840be41a159 Mon Sep 17 00:00:00 2001 From: dbabenko Date: Fri, 16 Jun 2017 16:53:58 -0400 Subject: [PATCH] add Dockerfile to build docker image (#386) --- .dockerignore | 4 ++++ Dockerfile | 19 +++++++++++++++++++ docker-compose.yml | 18 ++++++++++++++++++ docs/docs/01-quickstart.md | 1 + docs/docs/05-quickstartlocaldocker.md | 12 ++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docs/docs/05-quickstartlocaldocker.md diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..b6924c5a97 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.dockerignore +Dockerfile +docker-compose.yml +.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..c26913aa7c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:6.10.3 + +RUN useradd -U -d /opt/refocus refocus +ENV HOME=/opt/refocus +COPY . $HOME +RUN chown -R refocus:refocus $HOME + +USER refocus +WORKDIR $HOME +RUN npm install + +# sleep is to support pause during startup for deploys in kubernetes - delays start of refocus container to let pg and redis containers to start within the same pod. +ENV SLEEP=0 +ENV PGHOST=pg +ENV REDIS_URL=//redis:6379 + +EXPOSE 3000 + +CMD [ "/bin/sh", "-c", "sleep $SLEEP; npm start" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..dd82646385 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: '2' +services: + refocus-app: + build: . + ports: + - "3000:3000" + depends_on: + - "redis" + - "pg" + redis: + image: "redis:3.2.8" + expose: + - 6379 + pg: + image: "postgres:9.6.2" + expose: + - 5432 + diff --git a/docs/docs/01-quickstart.md b/docs/docs/01-quickstart.md index 2ef2cb1b52..dfbadd6d77 100644 --- a/docs/docs/01-quickstart.md +++ b/docs/docs/01-quickstart.md @@ -83,6 +83,7 @@ You have two ways to deploy Refocus. Select the one that best meets your needs. - I want [one-click Heroku deployment](./03-quickstartheroku.html) - I want to [download and build and deploy locally](./04-quickstartlocal.html) +- I want to [run Refocus locally as docker container](./05-quickstartlocaldocker.html) Refocus requires that both Redis and PostgreSQL are running. After Refocus is deployed, create an account and sign in. diff --git a/docs/docs/05-quickstartlocaldocker.md b/docs/docs/05-quickstartlocaldocker.md new file mode 100644 index 0000000000..fcb0321828 --- /dev/null +++ b/docs/docs/05-quickstartlocaldocker.md @@ -0,0 +1,12 @@ +--- +layout: docs +title: Quick Start with Local Docker +--- + +# QuickStart with Local Docker +# Prerequisites +1. Install docker [docker-for-mac](https://docs.docker.com/docker-for-mac/install/). +# Start refocus with dependencies +1. Clone this git repository. +2. Run `cd refocus`. +3. Run `docker-compose up`