FROM node:16-alpine as builder COPY package*.json ./ RUN npm set progress=false && npm config set depth 0 && npm cache clean --force RUN npm i && mkdir /ng-app && cp -R ./node_modules ./ng-app WORKDIR /ng-app COPY . . RUN $(npm bin)/ng build --configuration=production --build-optimizer FROM nginx:stable-alpine EXPOSE 80 COPY nginx/nginx.conf.template / RUN rm -rf /usr/share/nginx/html/* COPY --from=builder /ng-app/dist/frontend/ /usr/share/nginx/html RUN chown -R nginx:nginx /usr/share/nginx/html/ COPY nginx/run_nginx.sh / CMD ["sh", "/run_nginx.sh"]