Commit 818ab5ec authored by Juha's avatar Juha

Production version Dockerfile added

parent 1f8fb5f8
FROM node:6.10.2-alpine
# Create app directory
RUN mkdir /src
# Install app dependencies
ADD package.json npm-shrinkwrap.json /src/
# Update npm to a new version in a bit complicated way to go around several issues
# More info: https://github.com/npm/npm/issues/15611#issuecomment-289133810
RUN cd ~ && npm install npm@4.5.0 && rm -rf /usr/local/lib/node_modules && mv node_modules /usr/local/lib/
# Change the ownership of the copied files and change to node user
RUN chown -R node:node /src
USER node
# Install production dependencies
RUN cd /src && npm install --only=production --no-optional --loglevel warn && npm cache clean
# Copy all the files into container to make the container independent from local files
USER root
COPY . /src
RUN chown -R node:node /src/*
USER node
WORKDIR /src
# Define an open port for the container
EXPOSE 3100
# Defined in package.json
CMD [ "npm", "start" ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment