FROM node:14.1-alpine

WORKDIR /opt/web

COPY package.json ./

RUN npm install

COPY . ./

RUN npm run buildReact

FROM nginx

EXPOSE 80

COPY --from=0 /opt/web/build /usr/share/nginx/html

COPY nginx.conf /etc/nginx/conf.d/default.conf

CMD sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'

