Browse Source

Dockerfile

wangliang 1 tháng trước cách đây
mục cha
commit
e2761134b1
1 tập tin đã thay đổi với 13 bổ sung3 xóa
  1. 13 3
      web/tiku/Dockerfile

+ 13 - 3
web/tiku/Dockerfile

@@ -1,11 +1,21 @@
-FROM nginx:1.27.4
+ARG NODE_VERSION=18
+FROM node:${NODE_VERSION} AS build-stage
+ENV TZ Asia/Shanghai
+MAINTAINER wangliang@qmth.com.cn
+
+WORKDIR /opt
+COPY . .
+RUN npm config set registry http://registry.cnpmjs.org && npm config set registry http://registry.npm.taobao.org
+RUN npm install --legacy-peer-deps
+RUN NODE_OPTIONS=--max_old_space_size=4096 npm run build
+
+FROM nginx:1.27.4 AS production-stage
 ENV TZ Asia/Shanghai
 MAINTAINER wangliang@qmth.com.cn
 
 WORKDIR /opt
 RUN rm /etc/nginx/conf.d/default.conf
-COPY ./dist /opt/dist
-COPY ./dist-mark /opt/dist-mark
+COPY --from=build-stage /opt/dist /opt/dist
 COPY ./app.conf /etc/nginx/conf.d/app.conf
 COPY ./nginx.conf /etc/nginx/nginx.conf