Skip to content

Instantly share code, notes, and snippets.

@vijayst
Last active September 10, 2017 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijayst/14e5878d0a56bbb6a6240526701782b0 to your computer and use it in GitHub Desktop.
Save vijayst/14e5878d0a56bbb6a6240526701782b0 to your computer and use it in GitHub Desktop.
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
@vijayst
Copy link
Author

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