FROM node:17.9.1 AS app WORKDIR /app COPY package.json . COPY package-lock.json . RUN npm install COPY . . ARG REACT_APP_ENDPOINT ENV REACT_APP_ENDPOINT $REACT_APP_ENDPOINT ARG REACT_APP_ORIGIN ENV REACT_APP_ORIGIN $REACT_APP_ORIGIN RUN npm run build FROM nginx:alpine WORKDIR /usr/share/nginx/html RUN rm -rf ./* COPY --from=app /app/build . COPY nginx/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 ENTRYPOINT ["nginx", "-g", "daemon off;"]