Skip to content

fix(docker): 補 ARG VITE_SITE_URL 讓 Zeabur staging 建置生效(issue 682) - #685

Merged
s123104 merged 1 commit into
experiment/ratewise-product-2026h2from
fix/682-dockerfile-arg
Jul 8, 2026
Merged

fix(docker): 補 ARG VITE_SITE_URL 讓 Zeabur staging 建置生效(issue 682)#685
s123104 merged 1 commit into
experiment/ratewise-product-2026h2from
fix/682-dockerfile-arg

Conversation

@s123104

@s123104 s123104 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Closes #682

摘要

  • root Dockerfile builder stage 補宣告 ARG VITE_SITE_URL:Zeabur 服務層環境變數自此可進入 multi-stage vite build,fix(ratewise): manifest 網域改由 VITE_SITE_URL 環境驅動 #613 的 manifest 環境驅動修正在 staging 不再斷鏈(QA-I D7 根因)
  • 刻意不搭配 ENV:未傳值時 ARG 於 RUN 內保持 unset,generate-manifest.mjsprocess.env.VITE_SITE_URL || APP_INFO.siteUrl 與 seo-metadata 的 ?? APP_INFO.siteUrl 回退鏈不被空字串污染;RUN 內另加空字串 unset 防護(Zeabur 傳空值情境)
  • install 前補 COPY patches ./patchesfix(ratewise): 修復內容頁與 404 頁殘留的 React #418 hydration mismatch #622 引入 patchedDependenciesvite-react-ssg@0.8.9.patch)後,容器內 pnpm install --frozen-lockfile 缺 patch 檔必炸 ENOENT,本修正一併堵住
  • 移除 apk add git 與三段 git 回退死碼:.dockerignore 既排除 .git,容器內 git rev-list/git rev-parse 必然失敗且被 export VAR="$(...)" 靜默吞掉(exit status 為 export 的 0),版本 metadata 一律由 build args 提供(build-docker.sh SSOT)

兩情境驗證(issue #682 驗收標準)

情境 1 — 帶變數(staging)

VITE_SITE_URL=https://ratewise-staging.zeabur.app/ratewise/ pnpm build:ratewise
  • dist/manifest.webmanifeststart_url = scope = https://ratewise-staging.zeabur.app/ratewise/
  • dist/index.html canonical 同步指向 staging ✅

情境 2 — 無變數(正式站回退)

pnpm build:ratewise
  • dist/manifest.webmanifeststart_url = scope = https://app.haotool.org/ratewise/
  • 建置後 working tree 零 diff(tracked public/manifest.webmanifest 與 committed 版本零差異)✅

單元測試:build-scripts.test.ts 48 項全綠(含 manifest generator normalizeSiteUrl(process.env.VITE_SITE_URL || APP_INFO.siteUrl) 契約與 committed manifest 必為正式站守門)。

衛生項清單

  • 兩張誤入庫 QA 截圖出庫(.playwright-mcp/*.png git rm)
  • .gitignore 已有 .playwright-mcp/ 防再犯(第 92 行既有,無需補)
  • docs/dev/002 新增 reward 條目,檔頭重算 +193 → +194(verify-002-log.mjs 通過)
  • changeset(patch bump,描述使用者可見影響)
  • pre-commit 6 步驟+pre-push(typecheck / test / build:ratewise)全過

測試

測試:兩情境 build 產物驗證(staging 指向與正式站零變化)、build-scripts.test.ts 48 項全綠、pre-push 完整驗證通過

Made with Cursor

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

- builder stage 宣告 ARG VITE_SITE_URL:Zeabur 服務層環境變數得以進入 multi-stage vite build,
  staging manifest start_url/scope 正確指向 staging;不搭 ENV,RUN 內空字串 unset 防護回退鏈
- install 前補 COPY patches:修復 issue 622 引入 patchedDependencies 後容器 pnpm install ENOENT
- 移除 apk git 與三段 git 回退死碼(.dockerignore 排除 .git,容器內回退必然靜默失敗)
- 兩張誤入庫 QA 截圖出庫(.gitignore 既有 .playwright-mcp/ 防護)

測試:VITE_SITE_URL=staging pnpm build:ratewise 產物 manifest 與 canonical 指向 staging;
無變數 build 產物回退正式站且 tracked manifest 零差異;build-scripts.test.ts 48 項全綠

Co-authored-by: Cursor <cursoragent@cursor.com>
@s123104
s123104 force-pushed the fix/682-dockerfile-arg branch from 4db1249 to 8b7383d Compare July 8, 2026 01:28
@s123104
s123104 merged commit 54705ea into experiment/ratewise-product-2026h2 Jul 8, 2026
10 checks passed
@s123104
s123104 deleted the fix/682-dockerfile-arg branch July 8, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant