Skip to content

Commit

Permalink
Add Dockerfile for running in Docker
Browse files Browse the repository at this point in the history
Add .dockerignore file
Add Dockerfile-dev for faster dev builds
Add docker-compose.yml with common commands
Expose app to 0.0.0.0 instead of localhost

Bump version to 1.3.0
  • Loading branch information
tribou committed Aug 2, 2015
1 parent 890cd93 commit 00ff75a
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
.gitignore
.editorconfig
node_modules
*.log
*.md

20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:0.12
MAINTAINER tribou

# Prepare app directory
RUN mkdir -p /usr/src/app
ADD . /usr/src/app

# Install dependencies
WORKDIR /usr/src/app
RUN npm install

# Build the app
RUN npm build

# Expose the app port
EXPOSE 8000

# Start the app
CMD npm start

6 changes: 6 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM todo

ADD . /usr/src/app
RUN npm build
CMD npm start

13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
web:
build: .
dockerfile: Dockerfile-dev
links:
- db
environment:
- DB_HOST=db
ports:
- '8000:8000'
command: npm start
db:
image: mongo

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-todo",
"version": "1.2.0",
"version": "1.3.0",
"description": "Another basic todo app in React and Flux",
"main": "server.js",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var format = "dd mmm HH:MM:ss";
// Basic Hapi.js connection stuff
var server = new Hapi.Server();
server.connection({
host: 'localhost',
host: '0.0.0.0',
port: 8000
});

Expand Down

0 comments on commit 00ff75a

Please sign in to comment.