Created
April 4, 2020 20:01
-
-
Save iqan/215a1a2f3deb1811102bbb350143584d to your computer and use it in GitHub Desktop.
Docker file to build image for React App with Nginx
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
| # build stage | |
| FROM node:12.2.0-alpine as build | |
| WORKDIR /app | |
| ENV PATH /app/node_modules/.bin:$PATH | |
| COPY package.json /app/package.json | |
| RUN npm install --silent | |
| COPY . /app | |
| RUN npm run build | |
| # final stage | |
| FROM nginx:1.16.0-alpine | |
| COPY --from=build /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