Skip to content

Instantly share code, notes, and snippets.

@jkinkead
Created April 10, 2017 19:14
Show Gist options
  • Save jkinkead/9a915804fde025bc01ca68dde3f2f161 to your computer and use it in GitHub Desktop.
Save jkinkead/9a915804fde025bc01ca68dde3f2f161 to your computer and use it in GitHub Desktop.
Well-structured Dockerfile for a create-react-app application
# You should always specify a full version here to ensure all of your developers
# are running the same version of Node.
FROM node:7.8.0
# Override the base log level (info).
ENV NPM_CONFIG_LOGLEVEL warn
# Install and configure `serve`.
RUN npm install -g serve
CMD serve -s build
EXPOSE 5000
# Install all dependencies of the current project.
COPY package.json package.json
COPY npm-shrinkwrap.json npm-shrinkwrap.json
RUN npm install
# Copy all local files into the image.
COPY . .
# Build for production.
RUN npm run build --production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment