Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Deploy react app to heroku using Node 8.4 official image
# Items that don't need to be in a Docker image.
# Anything not used by the build system should go here.
Dockerfile
.dockerignore
.gitignore
README.md
yarn.lock
# Artifacts that will be built during image creation.
# This should contain all files created during `npm run build`.
.git
dist
node_modules
FROM node:8.4.0
# Override the base log level (info).
ENV NPM_CONFIG_LOGLEVEL warn
# Install `serve`.
RUN npm install -g serve
# Install all dependencies of the current project.
COPY package.json package.json
RUN npm install
# Copy all local files into the image.
COPY . .
# Build for production.
RUN npm run build
# serve static files in dist folder
CMD serve -p $PORT -s dist
Owner

vijayst commented Sep 10, 2017

For an explanation, please check the article.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment