Skip to content

Instantly share code, notes, and snippets.

@iqan
Created April 4, 2020 20:01
Show Gist options
  • Save iqan/215a1a2f3deb1811102bbb350143584d to your computer and use it in GitHub Desktop.
Save iqan/215a1a2f3deb1811102bbb350143584d to your computer and use it in GitHub Desktop.
Docker file to build image for React App with Nginx
# 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