ARG dist=/tmp/observe-ui/client/dist FROM node:14.21.3 as build-img WORKDIR /tmp ENV NODE_MODULES="/tmp/observe-ui/client/node_modules" ENV ROOTPATH="/root/ob-build/" ENV PROJECT="observe-ui" COPY ${ROOTPATH}${PROJECT} /tmp/${PROJECT} RUN cd /tmp/${PROJECT}/client # RUN npm install && npm install less-loader@5.0.0 less@4.2.0 RUN if [ ! -d "$NODE_MODULES" ];then npm install && npm install less-loader@5.0.0 less@4.2.0; fi RUN npm run build RUN cp /tmp/${PROJECT}/client/version /tmp/${PROJECT}/client/dist FROM nginx COPY --from=build-img ${dist} /usr/share/nginx/html/ EXPOSE 80