#Stage 1 - the build process FROM node:latest as build-deps WORKDIR /app #COPY package.json . COPY . . RUN npm install RUN npm run build RUN npm run build-css #Stage 2 - the production environment FROM nginx:latest ENV EXTERNAL_LOGIN=true RUN apt-get update && apt-get upgrade -y && \ apt-get install -y nodejs \ npm # note this one WORKDIR /usr/share/nginx/html COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build-deps /app/build /usr/share/nginx/html copy --from=build-deps /app/public/styles.css /usr/share/nginx/html # copy .env.example as .env to the container COPY .env.example .env RUN npm install -g cross-env RUN npm install -g runtime-env-cra EXPOSE 80 EXPOSE 443 CMD ["/bin/sh", "-c", "runtime-env-cra && nginx -g \"daemon off;\""]