Created
March 1, 2019 05:20
-
-
Save ironheart122/45c01d988c5d8dd5862baf7374f133a7 to your computer and use it in GitHub Desktop.
Dockerfile for deploying a React app (created via CRA) in 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 environment | |
FROM node:8.15-alpine as builder | |
WORKDIR /usr/src/app/ | |
COPY . ./ | |
RUN npm install --production | |
RUN npm run build | |
# Stage 2- production environment | |
FROM nginx:alpine | |
COPY nginx.conf /etc/nginx/conf.d/default.conf | |
COPY --from=builder /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