Skip to content

Instantly share code, notes, and snippets.

@eduardomp
Created April 20, 2021 23:26
Show Gist options
  • Save eduardomp/e606531ca1587d1feab2649085939d21 to your computer and use it in GitHub Desktop.
Save eduardomp/e606531ca1587d1feab2649085939d21 to your computer and use it in GitHub Desktop.
Dockerfile for React applications
FROM node:15-alpine AS build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
RUN apk add --no-cache --virtual yarn
COPY . /app
RUN yarn install --silent && \
yarn global add react-scripts@4.0.1 --silent && \
yarn run build
# serve the app
FROM nginx:stable-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