Dockerfile 648 B

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