Skip to content

Commit

Permalink
dockerfile for dockerhub.datacamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludovic Vannoorenberghe committed Jun 29, 2016
1 parent f9ecd9e commit 2857878
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
@@ -0,0 +1,7 @@
.tmp/
node_modules/
.env
.newrelic_agent.log
Procfile
docker-compose.yml
err.log
22 changes: 16 additions & 6 deletions Dockerfile
Expand Up @@ -5,13 +5,23 @@ MAINTAINER Ludovic Vannoorenberghe <ludo@datacamp.com>
RUN apt-get update && apt-get install -y python build-essential

RUN npm install -g node-gyp sails grunt bower npm-check-updates
RUN mkdir /server

# Define mountable directories.
VOLUME ["/server"]
ENV NODE_ENV production
# use changes to package.json to force Docker not to use the cache
# when we change our application's nodejs dependencies:
ADD package.json /tmp/package.json
RUN cd /tmp && npm cache clean && rm -rf node_modules && npm install --unsafe-perm --production
RUN mkdir -p /opt/app && cp -a /tmp/node_modules /opt/app/

# From here we load our application's code in, therefore the previous docker
# "layer" thats been cached will be used if possible
WORKDIR /opt/app
ADD . /opt/app

# Define working directory.
WORKDIR /server
# Define mountable directories.
VOLUME ["/opt/app"]

# Expose ports.
#Expose port
EXPOSE 1337

CMD ["node", "app.js"]
2 changes: 1 addition & 1 deletion docker-compose.yml
Expand Up @@ -16,7 +16,7 @@ server:
build: .
command: node app.js --verbose
volumes:
- .:/server
- .:/opt/app
ports:
- "1337:1337"
environment:
Expand Down

0 comments on commit 2857878

Please sign in to comment.