统一 Docker Chromium 构建缓存与主分支发布流程
- 使用 node:latest 作为 Docker 构建与运行时基础镜像,移除最终镜像中的 apt 更新和 Debian Chromium 依赖。 - 在 GitHub Actions 中按目标架构缓存并校验 Playwright driver、Chromium 与 headless shell runtime,Docker 和桌面端复用一致的版本校验逻辑。 - 让桌面端安装包工作流同时支持 main 与 codex/desktop-packaging 分支,保持 Linux 原生架构构建并避免 QEMU。 - 明确 main 发布 main、latest 标签,功能分支发布 desktop-packaging、alpha 标签。 - 同步 Compose 默认端口、Node.js 路径、健康检查及部署文档。
This commit is contained in:
1 parent
2df324647a
commit
542241d241
12 files changed
+150
-72
No files matched your search
@@ -0,0 +1 @@
|
||||
|
||||
@@ -14,3 +14,6 @@ init-admin
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
cover.out
|
||||
!/.docker/
|
||||
!/.docker/playwright-runtime/
|
||||
!/.docker/playwright-runtime/**
|
||||
@@ -3,6 +3,7 @@ name: 构建桌面端安装包
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- codex/desktop-packaging
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -19,7 +20,7 @@ env:
|
||||
jobs:
|
||||
linux:
|
||||
name: Linux 安装包 (${{ matrix.arch }})
|
||||
if: github.ref == 'refs/heads/codex/desktop-packaging'
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/codex/desktop-packaging'
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -64,10 +65,10 @@ jobs:
|
||||
|
||||
- name: 缓存 Linux Chromium runtime
|
||||
id: cache-linux-playwright
|
||||
uses: actions/cache/restore@v5
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: dist/ydisks-xianyu-helper-linux-${{ matrix.arch }}/playwright-runtime
|
||||
key: ydisks-playwright-runtime-v4-linux-${{ matrix.arch }}-${{ hashFiles('go.mod', 'go.sum', 'cmd/browser-install/main.go') }}
|
||||
key: ydisks-playwright-runtime-v6-linux-${{ matrix.arch }}-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
|
||||
- name: 在原生架构 runner 预下载 Linux Chromium runtime
|
||||
if: steps.cache-linux-playwright.outputs.cache-hit != 'true'
|
||||
@@ -92,13 +93,6 @@ jobs:
|
||||
-driver-dir "$PWD/$runtime_dir/playwright-driver" \
|
||||
-browser-dir "$PWD/$runtime_dir/playwright-browsers"
|
||||
|
||||
- name: 保存 Linux Chromium runtime 缓存
|
||||
if: steps.cache-linux-playwright.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v5
|
||||
with:
|
||||
path: dist/ydisks-xianyu-helper-linux-${{ matrix.arch }}/playwright-runtime
|
||||
key: ydisks-playwright-runtime-v4-linux-${{ matrix.arch }}-${{ hashFiles('go.mod', 'go.sum', 'cmd/browser-install/main.go') }}
|
||||
|
||||
- name: 校验 Linux Chromium runtime 架构
|
||||
env:
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
@@ -115,8 +109,12 @@ jobs:
|
||||
*) echo "Playwright driver 架构错误:$node_type" >&2; exit 1 ;;
|
||||
esac
|
||||
chromium_path="$(find "$runtime_dir/playwright-browsers" -type f \
|
||||
\( -name chrome -o -name headless_shell \) -perm -111 -print -quit)"
|
||||
\( -name chrome -o -name headless_shell -o -name chrome-headless-shell \) -perm -111 -print -quit)"
|
||||
test -n "$chromium_path"
|
||||
chromium_revision="$(RUNTIME_SPEC="$runtime_dir/playwright-driver/package/browsers.json" node -e 'const b=require(process.env.RUNTIME_SPEC).browsers; console.log(b.find(x=>x.name==="chromium").revision)')"
|
||||
headless_revision="$(RUNTIME_SPEC="$runtime_dir/playwright-driver/package/browsers.json" node -e 'const b=require(process.env.RUNTIME_SPEC).browsers; console.log(b.find(x=>x.name==="chromium-headless-shell").revision)')"
|
||||
test -d "$runtime_dir/playwright-browsers/chromium-$chromium_revision"
|
||||
test -d "$runtime_dir/playwright-browsers/chromium_headless_shell-$headless_revision"
|
||||
chromium_type="$(file -b "$chromium_path")"
|
||||
case "$GOARCH:$chromium_type" in
|
||||
amd64:*x86-64*) ;;
|
||||
@@ -142,7 +140,7 @@ jobs:
|
||||
|
||||
windows:
|
||||
name: Windows 安装包
|
||||
if: github.ref == 'refs/heads/codex/desktop-packaging'
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/codex/desktop-packaging'
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: 检出代码
|
||||
@@ -194,7 +192,7 @@ jobs:
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: dist/windows/playwright-runtime/amd64
|
||||
key: ydisks-playwright-runtime-v2-windows-amd64-${{ hashFiles('go.mod', 'go.sum', 'cmd/browser-install/main.go') }}
|
||||
key: ydisks-playwright-runtime-v6-windows-amd64-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
|
||||
- name: 预下载 Windows Chromium runtime
|
||||
if: steps.cache-windows-playwright.outputs.cache-hit != 'true'
|
||||
@@ -207,6 +205,24 @@ jobs:
|
||||
-browser-dir "$PWD/dist/windows/playwright-runtime/amd64/playwright-browsers"
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Windows Playwright runtime 下载失败' }
|
||||
|
||||
- name: 校验 Windows Chromium runtime
|
||||
shell: pwsh
|
||||
run: |
|
||||
$runtimeRoot = Resolve-Path 'dist/windows/playwright-runtime/amd64'
|
||||
$driverNode = Join-Path $runtimeRoot 'playwright-driver/node.exe'
|
||||
$driverCli = Join-Path $runtimeRoot 'playwright-driver/package/cli.js'
|
||||
if (-not (Test-Path -LiteralPath $driverNode -PathType Leaf)) { throw 'Windows Playwright driver 缺少 node.exe' }
|
||||
if (-not (Test-Path -LiteralPath $driverCli -PathType Leaf)) { throw 'Windows Playwright driver 缺少 package/cli.js' }
|
||||
$browserSpec = Get-Content -Raw -LiteralPath (Join-Path $runtimeRoot 'playwright-driver/package/browsers.json') | ConvertFrom-Json
|
||||
$chromiumRevision = ($browserSpec.browsers | Where-Object name -eq 'chromium').revision
|
||||
$headlessRevision = ($browserSpec.browsers | Where-Object name -eq 'chromium-headless-shell').revision
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $runtimeRoot "playwright-browsers/chromium-$chromiumRevision") -PathType Container)) { throw 'Windows Chromium revision 与 driver 不匹配' }
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $runtimeRoot "playwright-browsers/chromium_headless_shell-$headlessRevision") -PathType Container)) { throw 'Windows headless shell revision 与 driver 不匹配' }
|
||||
$chromium = Get-ChildItem -LiteralPath (Join-Path $runtimeRoot 'playwright-browsers') -Recurse -File |
|
||||
Where-Object { $_.Name -in @('chrome.exe', 'headless_shell.exe', 'chrome-headless-shell.exe') } |
|
||||
Select-Object -First 1
|
||||
if ($null -eq $chromium) { throw 'Windows Chromium runtime 缺少 Chromium 可执行文件' }
|
||||
|
||||
- name: 导入 Windows 签名证书
|
||||
shell: pwsh
|
||||
env:
|
||||
@@ -272,7 +288,7 @@ jobs:
|
||||
|
||||
macos:
|
||||
name: macOS 安装包
|
||||
if: github.ref == 'refs/heads/codex/desktop-packaging'
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/codex/desktop-packaging'
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- name: 检出代码
|
||||
@@ -313,7 +329,7 @@ jobs:
|
||||
path: |
|
||||
dist/macos/playwright-runtime/arm64
|
||||
dist/macos/playwright-runtime/amd64
|
||||
key: ydisks-playwright-runtime-v2-macos-universal-${{ hashFiles('go.mod', 'go.sum', 'cmd/browser-install/main.go') }}
|
||||
key: ydisks-playwright-runtime-v6-macos-universal-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
|
||||
- name: 预下载 macOS Chromium runtime
|
||||
if: steps.cache-macos-playwright.outputs.cache-hit != 'true'
|
||||
|
||||
@@ -26,9 +26,11 @@ jobs:
|
||||
- arch: amd64
|
||||
runner: ubuntu-24.04
|
||||
platform: linux/amd64
|
||||
playwright_platform: debian13-x64
|
||||
- arch: arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
platform: linux/arm64
|
||||
playwright_platform: debian13-arm64
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v6
|
||||
@@ -49,6 +51,52 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 配置 Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- name: 缓存 Docker Chromium runtime
|
||||
id: cache-docker-playwright
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: .docker/playwright-runtime/${{ matrix.arch }}
|
||||
key: ydisks-playwright-runtime-v6-docker-${{ matrix.arch }}-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
|
||||
- name: 准备 Docker Chromium runtime
|
||||
if: steps.cache-docker-playwright.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
env:
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
PLAYWRIGHT_HOST_PLATFORM_OVERRIDE: ${{ matrix.playwright_platform }}
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
mkdir -p ".docker/playwright-runtime/$GOARCH/playwright-driver" ".docker/playwright-runtime/$GOARCH/playwright-browsers"
|
||||
GOOS=linux GOARCH="$GOARCH" CGO_ENABLED=0 go build \
|
||||
-trimpath -ldflags='-s -w' \
|
||||
-o "$RUNNER_TEMP/browser-install" ./cmd/browser-install
|
||||
"$RUNNER_TEMP/browser-install" \
|
||||
-driver-dir "$PWD/.docker/playwright-runtime/$GOARCH/playwright-driver" \
|
||||
-browser-dir "$PWD/.docker/playwright-runtime/$GOARCH/playwright-browsers"
|
||||
|
||||
- name: 校验 Docker Chromium runtime
|
||||
shell: bash
|
||||
env:
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
runtime_dir=".docker/playwright-runtime/$GOARCH"
|
||||
test -x "$runtime_dir/playwright-driver/node"
|
||||
test -f "$runtime_dir/playwright-driver/package/cli.js"
|
||||
chromium_path="$(find "$runtime_dir/playwright-browsers" -type f \
|
||||
\( -name chrome -o -name headless_shell -o -name chrome-headless-shell \) -perm -111 -print -quit)"
|
||||
test -n "$chromium_path"
|
||||
chromium_revision="$(RUNTIME_SPEC="$runtime_dir/playwright-driver/package/browsers.json" node -e 'const b=require(process.env.RUNTIME_SPEC).browsers; console.log(b.find(x=>x.name==="chromium").revision)')"
|
||||
headless_revision="$(RUNTIME_SPEC="$runtime_dir/playwright-driver/package/browsers.json" node -e 'const b=require(process.env.RUNTIME_SPEC).browsers; console.log(b.find(x=>x.name==="chromium-headless-shell").revision)')"
|
||||
test -d "$runtime_dir/playwright-browsers/chromium-$chromium_revision"
|
||||
test -d "$runtime_dir/playwright-browsers/chromium_headless_shell-$headless_revision"
|
||||
|
||||
- name: 配置 Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
@@ -127,11 +175,12 @@ jobs:
|
||||
with:
|
||||
images: ${{ steps.image.outputs.name }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha,format=long
|
||||
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
|
||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||
type=raw,value=desktop-packaging,enable=${{ github.ref == 'refs/heads/codex/desktop-packaging' }}
|
||||
type=raw,value=alpha,enable=${{ github.ref == 'refs/heads/codex/desktop-packaging' }}
|
||||
|
||||
- name: 创建并推送多架构 manifest
|
||||
|
||||
@@ -106,10 +106,12 @@ packages explicitly bind the server to `127.0.0.1:59188` and keep the server and
|
||||
architecture, installs `ydisks-xianyu-helper.service`, and keeps data in `/var/lib/ydisks-xianyu-helper`.
|
||||
|
||||
All desktop packages contain the matching Playwright driver, Chromium and headless shell. Do not add a
|
||||
Debian Chromium package or download a second browser during installation. The desktop CI workflow runs
|
||||
only on `codex/desktop-packaging`; Linux amd64 and arm64 jobs use native GitHub-hosted runners and must
|
||||
not use QEMU or cross-architecture emulation. Docker publishing also builds each architecture on its native
|
||||
runner and publishes `latest` only from `main`, `alpha` only from `codex/desktop-packaging`.
|
||||
Debian Chromium package or download a second browser during installation. The Docker final image uses
|
||||
`node:latest`, copies the cached runtime prepared by CI, and does not run `apt-get update`. The desktop CI workflow
|
||||
runs on `main` and `codex/desktop-packaging`; Linux amd64 and arm64 jobs use native GitHub-hosted runners and
|
||||
must not use QEMU or cross-architecture emulation. Docker publishing also builds each architecture on its native
|
||||
runner and publishes `main` and `latest` from `main`, `desktop-packaging` and `alpha` from
|
||||
`codex/desktop-packaging`.
|
||||
|
||||
The tray state machine is shared by Windows and macOS: it serializes actions, shows transition states,
|
||||
waits for a healthy `/health` response after start/restart, waits for the endpoint to become unreachable
|
||||
|
||||
+40
-35
@@ -1,19 +1,12 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
FROM --platform=$BUILDPLATFORM node:22-trixie AS frontend
|
||||
FROM --platform=$BUILDPLATFORM node:latest AS frontend
|
||||
WORKDIR /src/frontend
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm ci
|
||||
COPY frontend/ ./
|
||||
RUN npm run build
|
||||
|
||||
FROM --platform=$BUILDPLATFORM golang:1.26-trixie AS browser-install-builder
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY cmd/browser-install ./cmd/browser-install
|
||||
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/browser-install-host ./cmd/browser-install
|
||||
|
||||
FROM --platform=$BUILDPLATFORM golang:1.26-trixie AS backend
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
@@ -26,51 +19,63 @@ RUN CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build -trimpath -ldfl
|
||||
&& CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build -trimpath -ldflags="-s -w" -o /out/xianyu-dbseed ./cmd/dbseed \
|
||||
&& CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build -trimpath -ldflags="-s -w" -o /out/xianyu-dbverify ./cmd/dbverify
|
||||
|
||||
# 使用与独立安装包相同的 browser-install 下载 driver 和 Chromium。
|
||||
# 该阶段运行在构建机架构上,但通过 PLAYWRIGHT_HOST_PLATFORM_OVERRIDE 下载目标架构的
|
||||
# Debian 13 Chromium;PLAYWRIGHT_NODEJS_PATH 让构建机 Node 执行 CLI。
|
||||
FROM --platform=$BUILDPLATFORM node:22-trixie AS playwright-runtime
|
||||
# 本地 Docker 构建没有主机 runtime 缓存时使用此工具下载一次;CI 会优先复制缓存,
|
||||
# 不会走这个兜底路径。
|
||||
FROM --platform=$BUILDPLATFORM golang:1.26-trixie AS browser-install-builder
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY cmd/browser-install ./cmd/browser-install
|
||||
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/browser-install-host ./cmd/browser-install
|
||||
|
||||
# Docker CI 会把与独立安装包相同的目标架构 runtime 放到
|
||||
# .docker/playwright-runtime,构建时直接复制,不在 Dockerfile 内重复下载浏览器。
|
||||
FROM --platform=$BUILDPLATFORM node:latest AS playwright-runtime
|
||||
ARG TARGETARCH
|
||||
ENV PLAYWRIGHT_DRIVER_PATH=/ms-playwright-go
|
||||
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
||||
ENV PLAYWRIGHT_NODEJS_PATH=/usr/local/bin/node
|
||||
COPY --from=browser-install-builder /out/browser-install-host /usr/local/bin/browser-install
|
||||
RUN mkdir -p /ms-playwright-go /ms-playwright \
|
||||
&& case "$TARGETARCH" in \
|
||||
amd64) playwright_platform=debian13-x64 ;; \
|
||||
arm64) playwright_platform=debian13-arm64 ;; \
|
||||
*) echo "不支持的 Docker 架构:$TARGETARCH" >&2; exit 1 ;; \
|
||||
esac \
|
||||
&& PLAYWRIGHT_HOST_PLATFORM_OVERRIDE="$playwright_platform" /usr/local/bin/browser-install \
|
||||
COPY .docker/playwright-runtime /prebuilt-playwright-runtime
|
||||
RUN set -eux; \
|
||||
mkdir -p /ms-playwright-go /ms-playwright; \
|
||||
case "$TARGETARCH" in \
|
||||
amd64) runtime_arch=amd64 ;; \
|
||||
arm64) runtime_arch=arm64 ;; \
|
||||
*) echo "不支持的 Docker 架构:$TARGETARCH" >&2; exit 1 ;; \
|
||||
esac; \
|
||||
if [ -f "/prebuilt-playwright-runtime/$runtime_arch/playwright-driver/package/cli.js" ]; then \
|
||||
cp -R "/prebuilt-playwright-runtime/$runtime_arch/playwright-driver/." /ms-playwright-go/; \
|
||||
cp -R "/prebuilt-playwright-runtime/$runtime_arch/playwright-browsers/." /ms-playwright/; \
|
||||
else \
|
||||
case "$TARGETARCH" in \
|
||||
amd64) playwright_platform=debian13-x64 ;; \
|
||||
arm64) playwright_platform=debian13-arm64 ;; \
|
||||
esac; \
|
||||
PLAYWRIGHT_HOST_PLATFORM_OVERRIDE="$playwright_platform" /usr/local/bin/browser-install \
|
||||
-driver-dir /ms-playwright-go \
|
||||
-browser-dir /ms-playwright
|
||||
-browser-dir /ms-playwright; \
|
||||
fi; \
|
||||
test -f /ms-playwright-go/package/cli.js; \
|
||||
chromium_revision="$(node -e 'const b=require("/ms-playwright-go/package/browsers.json").browsers; process.stdout.write(b.find(x=>x.name==="chromium").revision)')"; \
|
||||
headless_revision="$(node -e 'const b=require("/ms-playwright-go/package/browsers.json").browsers; process.stdout.write(b.find(x=>x.name==="chromium-headless-shell").revision)')"; \
|
||||
test -d "/ms-playwright/chromium-$chromium_revision"; \
|
||||
test -d "/ms-playwright/chromium_headless_shell-$headless_revision"; \
|
||||
find /ms-playwright -type f -perm -111 \( -name chrome -o -name chrome-headless-shell -o -name headless_shell \) -print -quit | grep -q .
|
||||
|
||||
FROM debian:13-slim AS runtime
|
||||
FROM node:latest AS runtime
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENV BROWSER_HEADLESS=true
|
||||
ENV PLAYWRIGHT_DRIVER_PATH=/ms-playwright-go
|
||||
ENV PLAYWRIGHT_NODEJS_PATH=/usr/bin/node
|
||||
ENV PLAYWRIGHT_NODEJS_PATH=/usr/local/bin/node
|
||||
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
||||
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
||||
WORKDIR /app
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
fonts-liberation \
|
||||
fonts-noto-cjk \
|
||||
nodejs \
|
||||
tzdata \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=backend /out/xianyu-server /app/xianyu-server
|
||||
COPY --from=backend /out/xianyu-dbseed /app/xianyu-dbseed
|
||||
COPY --from=backend /out/xianyu-dbverify /app/xianyu-dbverify
|
||||
COPY --from=playwright-runtime /ms-playwright-go /ms-playwright-go
|
||||
COPY --from=playwright-runtime /ms-playwright /ms-playwright
|
||||
# 只安装 Chromium 的系统库,不安装 Debian 的 chromium 包。Chromium 本体已经在上一个
|
||||
# 阶段从 Playwright 官方浏览器源下载并复制进镜像。
|
||||
RUN node /ms-playwright-go/package/cli.js install-deps chromium \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN mkdir -p /app/data /app/browser_data
|
||||
EXPOSE 59188
|
||||
CMD ["/app/xianyu-server", "-addr", ":59188"]
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
FROM alpine:3.22 AS sqlite-tools
|
||||
RUN apk add --no-cache sqlite
|
||||
|
||||
FROM node:22-trixie AS frontend-assets
|
||||
FROM node:latest AS frontend-assets
|
||||
WORKDIR /src/frontend
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm ci
|
||||
@@ -24,7 +24,7 @@ COPY . .
|
||||
COPY --from=frontend-assets /src/internal/webui/static ./internal/webui/static
|
||||
CMD ["golangci-lint", "run", "./..."]
|
||||
|
||||
FROM node:22-trixie AS frontend-test
|
||||
FROM node:latest AS frontend-test
|
||||
WORKDIR /src/frontend
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
@@ -208,7 +208,7 @@ Windows 和 macOS 托盘启动时会自动启动后台服务,并显示检查
|
||||
`/var/log/ydisks-xianyu-helper/server.log`,也可以使用
|
||||
`journalctl -u ydisks-xianyu-helper.service` 查看。
|
||||
|
||||
桌面端安装包由 GitHub Actions 的 `codex/desktop-packaging` 分支专用工作流构建:Linux 上传
|
||||
桌面端安装包由 GitHub Actions 工作流在 `main` 和 `codex/desktop-packaging` 分支构建:Linux 上传
|
||||
amd64/arm64 tar 包,Windows 上传安装器,macOS 分别上传 arm64 和 amd64 安装包。Windows
|
||||
和 macOS 安装包使用工作流中配置的固定签名证书签名;未配置对应 GitHub Secrets 时,签名
|
||||
步骤会失败,不会生成可分发的安装包。
|
||||
@@ -411,9 +411,9 @@ ARM64 Linux 拉取 arm64,不需要手动设置 `platform`。
|
||||
| `codex/desktop-packaging` 分支 | `alpha`、`desktop-packaging`、`sha-<完整提交号>` |
|
||||
| `v1.2.3` 标签 | `1.2.3`、`1.2`、`sha-<完整提交号>` |
|
||||
|
||||
当前 Docker 发布工作流会在 `main` 分支发布正式镜像,并在
|
||||
`codex/desktop-packaging` 分支发布 `alpha` 标签用于验收;其他开发分支不会自动生成
|
||||
GHCR 标签。
|
||||
当前 Docker 发布工作流会在 `main` 分支发布 `main` 和 `latest` 正式镜像,并在
|
||||
`codex/desktop-packaging` 分支发布 `desktop-packaging` 和 `alpha` 标签用于验收;其他开发分支
|
||||
不会自动生成 GHCR 标签。
|
||||
|
||||
生产环境建议使用明确的版本标签或 SHA 标签,避免上游更新导致未经验证的自动升级。
|
||||
|
||||
@@ -649,8 +649,9 @@ go run ./cmd/server -init-admin -db data/xianyu_data.db -admin-password '新密
|
||||
|
||||
### Chromium 或 Playwright 初始化失败
|
||||
|
||||
- Docker 部署优先使用项目提供的镜像,镜像在构建阶段已下载 Chromium,并包含运行依赖;
|
||||
不依赖 Debian 仓库中的 `chromium` 包。
|
||||
- Docker 部署优先使用项目提供的镜像,镜像在构建阶段已下载并校验匹配架构的 Chromium runtime;
|
||||
Docker CI 优先复用 GitHub Actions 缓存,不依赖 Debian 仓库中的 `chromium` 包,也不会在最终镜像
|
||||
构建阶段执行 `apt-get update`。
|
||||
- 独立安装包在 CI 构建阶段下载对应架构的 Playwright driver 和 Chromium;Linux 安装时只
|
||||
安装系统库,不需要再次下载浏览器。
|
||||
- 源码运行时确认系统允许下载 Playwright 驱动和 Chromium。
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ x-app-env: &app-env
|
||||
LOG_FORMAT: ${LOG_FORMAT:-json}
|
||||
BROWSER_HEADLESS: ${BROWSER_HEADLESS:-true}
|
||||
PLAYWRIGHT_DRIVER_PATH: ${PLAYWRIGHT_DRIVER_PATH:-/ms-playwright-go}
|
||||
PLAYWRIGHT_NODEJS_PATH: ${PLAYWRIGHT_NODEJS_PATH:-/usr/bin/node}
|
||||
PLAYWRIGHT_NODEJS_PATH: ${PLAYWRIGHT_NODEJS_PATH:-/usr/local/bin/node}
|
||||
PLAYWRIGHT_BROWSERS_PATH: ${PLAYWRIGHT_BROWSERS_PATH:-/ms-playwright}
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: ${PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD:-1}
|
||||
|
||||
@@ -50,7 +50,7 @@ services:
|
||||
- "${XIANYU_BIND_ADDRESS:-0.0.0.0}:${XIANYU_HTTP_PORT:-59188}:59188"
|
||||
volumes: *app-volumes
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:59188/health >/dev/null || exit 1"]
|
||||
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:59188/health',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
@@ -7,7 +7,7 @@ x-app-env: &app-env
|
||||
LOG_FORMAT: ${LOG_FORMAT:-json}
|
||||
BROWSER_HEADLESS: ${BROWSER_HEADLESS:-true}
|
||||
PLAYWRIGHT_DRIVER_PATH: ${PLAYWRIGHT_DRIVER_PATH:-/ms-playwright-go}
|
||||
PLAYWRIGHT_NODEJS_PATH: ${PLAYWRIGHT_NODEJS_PATH:-/usr/bin/node}
|
||||
PLAYWRIGHT_NODEJS_PATH: ${PLAYWRIGHT_NODEJS_PATH:-/usr/local/bin/node}
|
||||
PLAYWRIGHT_BROWSERS_PATH: ${PLAYWRIGHT_BROWSERS_PATH:-/ms-playwright}
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: ${PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD:-1}
|
||||
|
||||
@@ -50,7 +50,7 @@ services:
|
||||
- "${XIANYU_BIND_ADDRESS:-0.0.0.0}:${XIANYU_HTTP_PORT:-59188}:59188"
|
||||
volumes: *app-volumes
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:59188/health >/dev/null || exit 1"]
|
||||
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:59188/health',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
@@ -128,7 +128,7 @@ services:
|
||||
- app_mysql_data:/app/data
|
||||
- app_mysql_browser_data:/app/browser_data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:59188/health >/dev/null"]
|
||||
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:59188/health',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
@@ -150,7 +150,7 @@ services:
|
||||
- app_sqlite_data:/app/data
|
||||
- app_sqlite_browser_data:/app/browser_data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:59188/health >/dev/null"]
|
||||
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:59188/health',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
@@ -172,7 +172,7 @@ services:
|
||||
- app_postgres_data:/app/data
|
||||
- app_postgres_browser_data:/app/browser_data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:59188/health >/dev/null"]
|
||||
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:59188/health',r=>process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
|
||||
+3
-2
@@ -29,8 +29,9 @@ Docker 中的自动续期会使用容器内 Chromium 检测到的 Linux 原生
|
||||
## 独立安装包
|
||||
|
||||
独立安装包与 Docker 使用同一套 Playwright Chromium 版本来源:Chromium、headless shell 和
|
||||
Playwright driver 都在构建阶段下载并放入包内,不使用 Debian 仓库的 Chromium。安装时只补齐
|
||||
目标系统所需的动态库和其他系统依赖;安装后不需要用户再执行浏览器下载命令。
|
||||
Playwright driver 都在构建阶段下载并放入包内,不使用 Debian 仓库的 Chromium。Docker CI 会优先
|
||||
复用架构专属的 GitHub Actions runtime 缓存,Dockerfile 最终使用 `node:latest` 运行时,不执行
|
||||
`apt-get update` 或安装 Debian Chromium。安装时不需要用户再执行浏览器下载命令。
|
||||
|
||||
| 平台 | 安装方式 | 服务标识 | 默认地址 |
|
||||
| --- | --- | --- | --- |
|
||||
|
||||
Reference in new issue
Block a user