Skip to content

Instantly share code, notes, and snippets.

@learncodeacademy
Created March 27, 2015 02:20
Show Gist options
  • Save learncodeacademy/ef9a4c2c69e4ae0c32f8 to your computer and use it in GitHub Desktop.
Save learncodeacademy/ef9a4c2c69e4ae0c32f8 to your computer and use it in GitHub Desktop.
Node Dockerfile
FROM node:0.12.0
# 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 && mkdir data && npm install --production --unsafe-perm
RUN mkdir -p /app && cp -a /tmp/node_modules /app/ && cp -a /tmp/data /app/
# From here we load our application's code in, therefore the previous docker
# "layer" thats been cached will be used if possible
WORKDIR /app
ADD . /app
EXPOSE 3000
ENV NODE_ENV production
CMD ["npm", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment