Last active
September 10, 2017 15:04
-
-
Save vijayst/14e5878d0a56bbb6a6240526701782b0 to your computer and use it in GitHub Desktop.
Deploy react app to heroku using Node 8.4 official image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For an explanation, please check the article.