# pull official base image FROM node AS builder # set working directory WORKDIR /app # install app dependencies #copies package.json and package-lock.json to Docker environment COPY package.json ./ # Installs all node packages RUN npm install # Copies everything over to Docker environment COPY . ./ RUN npm run build #Stage 2 ####################################### #pull the official nginx:1.19.0 base image FROM nginx #copies React to the container directory # Set working directory to nginx resources directory WORKDIR /usr/share/nginx/html # Remove default nginx static resources RUN rm -rf ./* RUN apt-get install bash # Copies configuration files COPY ./default.conf /etc/nginx/conf.d/default.conf # Copies static resources from builder stage COPY --from=builder /app/build . # Containers run nginx with global directives and daemon off ENTRYPOINT ["nginx", "-g", "daemon off;"]