### STAGE 1: Build ### FROM node:10-alpine as build # Create directories for setting up the structure RUN mkdir /home/node/app # Create app directory WORKDIR /home/node/app # Add env path ENV PATH /home/node/app/node_modules/.bin:$PATH # Install app dependencies # A wildcard is used to ensure both package.json AND package-lock.json are copied # where available (npm@5+) COPY package*.json ./ # Switch user #USER node # Run npm to install dependencies in package*.json RUN npm install --silent RUN npm install @okta/okta-react --silent RUN npm install http-proxy-middleware #RUN npm install -g http-server --silent RUN npm install -g serve --silent # Run npm to install serve #RUN npm install serve # Copy your application code with appropriate permissions to the application directory COPY . /home/node/app # If you are building your code for production RUN npm run build EXPOSE 3000 CMD ["serve", "build"] ### STAGE 2: Production Environment ### #FROM nginx:1.13.12-alpine #COPY --from=build /home/node/app/build /usr/share/nginx/html #RUN rm /etc/nginx/conf.d/default.conf #COPY nginx-conf/nginx.conf /etc/nginx/conf.d #EXPOSE 80 #CMD ["nginx", "-g", "daemon off;"]