Forked from dennisschneider/create-react-app with docker multi-stage setup
Created
August 16, 2018 14:11
-
-
Save yokodev/3f6af89485e684ac8f61b8ffec10f391 to your computer and use it in GitHub Desktop.
Dockerfile to deploy a create-react-app project to production
This file contains hidden or 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
### STAGE 1: Build ### | |
FROM node:9.11.1 as build | |
RUN mkdir /usr/src/app | |
WORKDIR /usr/src/app | |
ENV PATH /usr/src/app/node_modules/.bin:$PATH | |
COPY package.json /usr/src/app/package.json | |
RUN npm install --silent | |
RUN npm install react-scripts -g --silent | |
COPY . /usr/src/app | |
RUN npm run build | |
### STAGE 2: Production Environment ### | |
FROM nginx:1.13.12-alpine | |
COPY --from=build /usr/src/app/build /usr/share/nginx/html | |
EXPOSE 80 | |
CMD ["nginx", "-g", "daemon off;"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment