Created
August 24, 2018 11:21
-
-
Save justindavies/c61564de4e52eb211ae0bd45bde81e01 to your computer and use it in GitHub Desktop.
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 environment | |
FROM node as builder | |
ARG REACT_APP_SHA | |
ENV REACT_APP_SHA=${REACT_APP_SHA} | |
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 -g -s --no-progress yarn | |
RUN yarn add react-scripts -g | |
COPY . /usr/src/app | |
RUN yarn build | |
# production environment | |
FROM nginx:1.13.9-alpine | |
COPY --from=builder /usr/src/app/build /usr/share/nginx/html | |
# Fix NGINX config for React | |
#RUN sed -ie 's/index index.html index.htm;/try_files $uri $uri\/ \/index.html;/g' /etc/nginx/conf.d/default.conf | |
COPY nginx.conf /etc/nginx/conf.d/default.conf | |
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