FROM node:16.6.1-alpine AS builder WORKDIR /tmp COPY package*.json ./ RUN npm ci --only=prod COPY . . ENV NODE_ENV=production RUN npm run build FROM nginx:alpine COPY --from=builder /tmp/build /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf RUN touch /var/run/nginx.pid RUN chown -R nginx:nginx /var/run/nginx.pid /usr/share/nginx/html /var/cache/nginx /var/log/nginx /etc/nginx/conf.d USER nginx EXPOSE 8080 CMD ["nginx", "-g", "daemon off;"]