buildDockerfile 594 B

123456789101112131415161718192021
  1. ARG dist=/tmp/observe-ui/client/dist
  2. FROM node:14.21.3 as build-img
  3. WORKDIR /tmp
  4. ENV NODE_MODULES="/tmp/observe-ui/client/node_modules"
  5. ENV ROOTPATH="/root/ob-build/"
  6. ENV PROJECT="observe-ui"
  7. COPY ${ROOTPATH}${PROJECT} /tmp/${PROJECT}
  8. RUN cd /tmp/${PROJECT}/client
  9. # RUN npm install && npm install less-loader@5.0.0 less@4.2.0
  10. RUN if [ ! -d "$NODE_MODULES" ];then npm install && npm install less-loader@5.0.0 less@4.2.0; fi
  11. RUN npm run build
  12. RUN cp /tmp/${PROJECT}/client/version /tmp/${PROJECT}/client/dist
  13. FROM nginx
  14. COPY --from=build-img ${dist} /usr/share/nginx/html/
  15. EXPOSE 80