Dockerfile 575 B

123456789101112131415161718192021
  1. FROM node:18 AS build-stage
  2. ENV TZ Asia/Shanghai
  3. MAINTAINER wangliang@qmth.com.cn
  4. WORKDIR /app
  5. COPY . .
  6. RUN npm config set registry http://registry.cnpmjs.org && npm config set registry http://registry.npm.taobao.org
  7. RUN npm install
  8. RUN NODE_OPTIONS=--max_old_space_size=4096 npm run build
  9. FROM nginx:1.17.3 AS production-stage
  10. ENV TZ Asia/Shanghai
  11. MAINTAINER wangliang@qmth.com.cn
  12. WORKDIR /opt
  13. ARG CONF_NAME
  14. #RUN rm /etc/nginx/conf.d/default.conf
  15. COPY --from=build-stage /app/dist /opt/dist
  16. COPY ./$CONF_NAME /etc/nginx/conf.d/$CONF_NAME
  17. CMD ["nginx","-g","daemon off;"]