Dockerfile 629 B

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