From 0e8fe2cbfed1f268743a7dd93cf8c20dbce543b6 Mon Sep 17 00:00:00 2001 From: tiananlin Date: Tue, 15 Sep 2026 11:10:19 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Dockerfiles/Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/Dockerfile b/Dockerfiles/Dockerfile index 627327b..5c3955c 100644 --- a/Dockerfiles/Dockerfile +++ b/Dockerfiles/Dockerfile @@ -26,7 +26,7 @@ RUN pnpm install --frozen-lockfile --fetch-timeout 300000 COPY . . # 构建项目 -RUN npm run build:pro +RUN npm run build:public # 部署阶段 FROM registry-vpc.cn-chengdu.aliyuncs.com/zhixueli-prod/nginx:alpine From aa4961cd6ef792270da2417ca4d92bec92f9d060 Mon Sep 17 00:00:00 2001 From: tiananlin Date: Tue, 15 Sep 2026 11:15:44 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Dockerfiles/Dockerfile?= =?UTF-8?q?-public/default.conf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/Dockerfile-public/default.conf | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Dockerfiles/Dockerfile-public/default.conf diff --git a/Dockerfiles/Dockerfile-public/default.conf b/Dockerfiles/Dockerfile-public/default.conf new file mode 100644 index 0000000..44210dd --- /dev/null +++ b/Dockerfiles/Dockerfile-public/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/open/onboarding/ { + proxy_pass http://onboardx-api-svc:5566/open/onboarding/; + 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 From c4daaae117abb9dc8e6ee1caa4838923b92455ed Mon Sep 17 00:00:00 2001 From: tiananlin Date: Tue, 15 Sep 2026 11:18:04 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Dockerfiles/Dockerfile?= =?UTF-8?q?-public/Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/Dockerfile-public/Dockerfile | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Dockerfiles/Dockerfile-public/Dockerfile diff --git a/Dockerfiles/Dockerfile-public/Dockerfile b/Dockerfiles/Dockerfile-public/Dockerfile new file mode 100644 index 0000000..5c3955c --- /dev/null +++ b/Dockerfiles/Dockerfile-public/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:public + +# 部署阶段 +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 8d4bee03e82c3e6784db78371bc9c9c3051d7db1 Mon Sep 17 00:00:00 2001 From: tiananlin Date: Tue, 15 Sep 2026 11:18:30 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Dockerfiles/Dockerfile?= =?UTF-8?q?-admin/default.conf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/Dockerfile-admin/default.conf | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Dockerfiles/Dockerfile-admin/default.conf diff --git a/Dockerfiles/Dockerfile-admin/default.conf b/Dockerfiles/Dockerfile-admin/default.conf new file mode 100644 index 0000000..4f6fae2 --- /dev/null +++ b/Dockerfiles/Dockerfile-admin/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 From fd5b85e20fa541865c22d93d7b56af721adc1e85 Mon Sep 17 00:00:00 2001 From: tiananlin Date: Tue, 15 Sep 2026 11:19:23 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Dockerfiles/Dockerfile?= =?UTF-8?q?-admin/Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/Dockerfile-admin/Dockerfile | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Dockerfiles/Dockerfile-admin/Dockerfile diff --git a/Dockerfiles/Dockerfile-admin/Dockerfile b/Dockerfiles/Dockerfile-admin/Dockerfile new file mode 100644 index 0000000..464f90c --- /dev/null +++ b/Dockerfiles/Dockerfile-admin/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:admin + +# 部署阶段 +FROM registry-vpc.cn-chengdu.aliyuncs.com/zhixueli-prod/nginx:alpine + +# 复制构建产物到 Nginx 目录 +COPY --from=builder --chown=nginx:nginx /app/dist-admin /usr/share/nginx/html + +# 复制 Nginx 配置 +COPY Dockerfiles/Dockerfile-admin/default.conf /etc/nginx/conf.d/default.conf + +# 暴露端口 +EXPOSE 80 + +# 启动 Nginx +CMD ["nginx", "-g", "daemon off;"] From 52c8ddc09e45a4ca9d3b816d1d84c04da43eb7db Mon Sep 17 00:00:00 2001 From: tiananlin Date: Tue, 15 Sep 2026 11:19:54 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Dockerfiles/Dockerfile?= =?UTF-8?q?-public/Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/Dockerfile-public/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfiles/Dockerfile-public/Dockerfile b/Dockerfiles/Dockerfile-public/Dockerfile index 5c3955c..c6dfd57 100644 --- a/Dockerfiles/Dockerfile-public/Dockerfile +++ b/Dockerfiles/Dockerfile-public/Dockerfile @@ -32,10 +32,10 @@ RUN npm run build:public FROM registry-vpc.cn-chengdu.aliyuncs.com/zhixueli-prod/nginx:alpine # 复制构建产物到 Nginx 目录 -COPY --from=builder --chown=nginx:nginx /app/dist /usr/share/nginx/html +COPY --from=builder --chown=nginx:nginx /app/dist-public /usr/share/nginx/html # 复制 Nginx 配置 -COPY Dockerfiles/default.conf /etc/nginx/conf.d/default.conf +COPY Dockerfiles/Dockerfile-public/default.conf /etc/nginx/conf.d/default.conf # 暴露端口 EXPOSE 80 From 763c27d5c6786d3cbf18002b9a754f6539840917 Mon Sep 17 00:00:00 2001 From: tiananlin Date: Tue, 15 Sep 2026 11:20:28 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E5=88=A0=E9=99=A4=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 deletions(-) delete mode 100644 Dockerfiles/default.conf diff --git a/Dockerfiles/default.conf b/Dockerfiles/default.conf deleted file mode 100644 index 4f6fae2..0000000 --- a/Dockerfiles/default.conf +++ /dev/null @@ -1,27 +0,0 @@ -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 From d6d4fb2885d41f26544923f8acb238ff051b0cdc Mon Sep 17 00:00:00 2001 From: tiananlin Date: Tue, 15 Sep 2026 11:20:34 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=88=A0=E9=99=A4=20Dockerfiles/Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/Dockerfile | 44 ------------------------------------------ 1 file changed, 44 deletions(-) delete mode 100644 Dockerfiles/Dockerfile diff --git a/Dockerfiles/Dockerfile b/Dockerfiles/Dockerfile deleted file mode 100644 index 5c3955c..0000000 --- a/Dockerfiles/Dockerfile +++ /dev/null @@ -1,44 +0,0 @@ -# 构建阶段 -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:public - -# 部署阶段 -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 cbedb66bff00366a953e2cf113f8e224e4c96837 Mon Sep 17 00:00:00 2001 From: tiananlin Date: Tue, 15 Sep 2026 11:31:44 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Dockerfiles/Dockerfile?= =?UTF-8?q?-public/default.conf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfiles/Dockerfile-public/default.conf | 34 +++++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/Dockerfiles/Dockerfile-public/default.conf b/Dockerfiles/Dockerfile-public/default.conf index 44210dd..e07c21c 100644 --- a/Dockerfiles/Dockerfile-public/default.conf +++ b/Dockerfiles/Dockerfile-public/default.conf @@ -1,27 +1,45 @@ server { listen 80; - server_name localhost; + server_name _; client_max_body_size 100m; - root /usr/share/nginx/html; index index.html; - location / { - try_files $uri $uri/ /index.html; + add_header X-Robots-Tag "noindex, nofollow" always; + + # 公开构建中的 sw.js 只负责注销该域名历史遗留的后台 PWA。 + location = /sw.js { + add_header Cache-Control "no-store, no-cache, must-revalidate"; + try_files $uri =404; } - location /api/open/onboarding/ { + location = /index.html { + add_header Cache-Control "no-store, no-cache, must-revalidate"; + try_files $uri =404; + } + + # 员工域名只允许入职公开接口。内部后端路由不包含外层 /api。 + location ^~ /api/open/onboarding/ { proxy_pass http://onboardx-api-svc:5566/open/onboarding/; proxy_http_version 1.1; - + proxy_request_buffering off; 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 + + # 公开域名拒绝系统、后台业务及其他 API。 + location ^~ /api/ { + return 404; + } + + # Hash 路由的有效链接在服务器看来也是根路径,必须返回公开版 index.html。 + location / { + try_files $uri $uri/ /index.html; + } +}