Skip to content

Commit

Permalink
Add docker support for development via docker-compose. Closes #1078
Browse files Browse the repository at this point in the history
This will allow developers to have a running DemocracyOS environment,
with build-watch-serve functionalities; just run `docker-compose up app`.
  • Loading branch information
gvilarino committed May 26, 2016
1 parent 6059490 commit 5f22d8b
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 23 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
.env
.DS_Store
.dockerignore
docker
docs
node_modules

config/*.json
!config/defaults.json

# Docs
*.md

Procfile

# Never leave out the license
!LICENSE.txt
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*.pid
*.seed
*.sublime-*
.env
.idea/*
.npmrc
.tmp
Expand Down
20 changes: 0 additions & 20 deletions Dockerfile

This file was deleted.

6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ packages:
@echo "Installing dependencies..."
@npm install

docker:
@echo "Starting DemocracyoOS docker development environment..."
@docker-compose up app

clean:
@echo "Removing dependencies, components and built assets..."
@rm -rf node_modules components public
@echo "Done.\n"

.PHONY: clean
.PHONY: clean docker
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '2'

services:
app:
build:
context: .
dockerfile: ./docker/development.Dockerfile
env_file: docker/.env
links:
- mongo
ports:
- "3000:3000"
# mount source volume, but
# don't overwrite `node_modules` or mirror dir from container
volumes:
- ${PWD}:/usr/src
- /usr/src/node_modules
tty: true

mongo:
image: mongo
# Optionally mount external data directory
# volumes:
# - path-to-your-data-dir:/data/db
2 changes: 2 additions & 0 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Required for running under docker compose
MONGO_URL=mongodb://mongo/DemocracyOS-dev
16 changes: 16 additions & 0 deletions docker/development.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:argon
MAINTAINER Guido Vilariño <guido@democracyos.org>

RUN apt-get update && \
apt-get install -y libkrb5-dev && \
npm config set python python2.7

COPY package.json /usr/src/

WORKDIR /usr/src

RUN npm install --quiet --unsafe-perm

EXPOSE 3000

CMD ["./node_modules/.bin/gulp", "bws"]
2 changes: 1 addition & 1 deletion lib/boot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ app.use(express.errorHandler());
/**
* Load Styleguide
*/
if ('development' === config.env) {
if ('production' !== config.env) {
app.use(require('lib/styleguide'));
}

Expand Down

0 comments on commit 5f22d8b

Please sign in to comment.