From 19dfca3ed0a252583104341c3106fc6bb28b94dc Mon Sep 17 00:00:00 2001 From: tiananlin Date: Fri, 28 Aug 2026 18:11:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Dockerfiles/Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Dockerfiles/Dockerfile diff --git a/Dockerfiles/Dockerfile b/Dockerfiles/Dockerfile new file mode 100644 index 0000000..627327b --- /dev/null +++ b/Dockerfiles/Dockerfile @@ -0,0 +1,44 @@ +# 构建阶段 +FROM registry-vpc.cn-chengdu.aliyuncs.com/zhixueli-prod/node:18.20.3 AS builder + +# 设置工作目录 +WORKDIR /app + +# 设置 npm 镜像源 +RUN npm config set registry https://registry.npmmirror.com/ +RUN npm config set fetch-retries 3 +RUN npm config set fetch-retry-mintimeout 5000 +RUN npm config set fetch-retry-maxtimeout 60000 + +# 安装pnpm +RUN npm install -g pnpm@10.16.1 + +# 复制 package.json +COPY package.json pnpm-lock.yaml ./ + +# 设置 pnpm 下载源 +RUN pnpm config set registry https://registry.npmmirror.com/ + +# 安装依赖 +RUN pnpm install --frozen-lockfile --fetch-timeout 300000 + +# 复制源代码 +COPY . . + +# 构建项目 +RUN npm run build:pro + +# 部署阶段 +FROM registry-vpc.cn-chengdu.aliyuncs.com/zhixueli-prod/nginx:alpine + +# 复制构建产物到 Nginx 目录 +COPY --from=builder --chown=nginx:nginx /app/dist /usr/share/nginx/html + +# 复制 Nginx 配置 +COPY Dockerfiles/default.conf /etc/nginx/conf.d/default.conf + +# 暴露端口 +EXPOSE 80 + +# 启动 Nginx +CMD ["nginx", "-g", "daemon off;"] From 43fc6873b34c36bba5f8edd39ffc0a3a0596d0f7 Mon Sep 17 00:00:00 2001 From: tiananlin Date: Fri, 28 Aug 2026 18:11:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Dockerfiles/default.co?= =?UTF-8?q?nf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/default.conf | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Dockerfiles/default.conf diff --git a/Dockerfiles/default.conf b/Dockerfiles/default.conf new file mode 100644 index 0000000..4f6fae2 --- /dev/null +++ b/Dockerfiles/default.conf @@ -0,0 +1,27 @@ +server { + listen 80; + server_name localhost; + + client_max_body_size 100m; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location /api/ { + proxy_pass http://onboardx-api-svc:5566/; + proxy_http_version 1.1; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_connect_timeout 60s; + proxy_read_timeout 300s; + proxy_send_timeout 300s; + } +} \ No newline at end of file