14 Commits

Author SHA1 Message Date
xfy
089fe88a75 fix(docker): 复制 patches/ 目录以修复 pnpm install ENOENT
Some checks failed
CI / check (push) Has been cancelled
CI / build (push) Has been cancelled
pnpm-workspace.yaml 声明了指向 patches/@tiptap__markdown@3.27.3.patch 的
patched 依赖,但 Docker 构建在 COPY package manifest 阶段未包含
patches/ 目录,导致 pnpm install --frozen-lockfile 因找不到 patch
文件而失败。将 libs/patches/ 加入 COPY 即可。
2026-07-23 16:45:00 +08:00
xfy
856eeb758c fix(build): Docker 构建透传 git 信息,修复 x-yggdrasil-git 恒为 unknown
.dockerignore 排除 .git/,容器内 build.rs 跑不了 git 命令,导致
x-yggdrasil-git / git_hash / commit_date 响应头和启动日志全是 "unknown"
(version 来自 CARGO_PKG_VERSION 不受影响)。

三级取值链(build.rs env_or_git):
  YGG_BUILD_* 环境变量 → 本地 git 命令 → "unknown"
第一级 std::env::var 优先读 docker --build-arg 注入的值,第二级保留
本地 cargo build 的既有行为,兜底不变。

- Dockerfile: 主应用 server build 前加 ARG+ENV 块(ARG 仅 RUN 可见,
  build.rs 由 cargo 调用非 RUN,故需 export 成 ENV 让 cargo build 继承)
- Makefile: GIT_DESCRIBE/HASH/DATE 在宿主采集,GIT_BUILD_ARGS 复用块
  注入 docker/docker-amd64/docker-multiarch 三个 target
- deploy-to-linux skill: 两处 docker buildx build 命令(首装 + 更新)
  加同名 --build-arg,附说明
2026-07-22 16:05:49 +08:00
xfy
e3e0829fcd fix(docker): 预装 binaryen 避免 dx 运行时下载 wasm-opt 失败
Some checks failed
CI / check (push) Has been cancelled
CI / build (push) Has been cancelled
dx build @client --release 默认启用 wasm-opt 优化 WASM bundle。
镜像缺失 wasm-opt 时,dx 内部会从 GitHub Releases 动态下载,
而这个下载不受 Dockerfile 的 GH_PROXY 控制(GH_PROXY 只覆盖
dx/tailwindcss 那两个显式 curl 调用)。

后果:容器内 80 分钟超时后报
  Failed to create wasm-opt instance
  error decoding response body
  error reading a body from connection
  stream error received: unspecific protocol error detected

apt 装 binaryen 把 wasm-opt 放到 /usr/bin,dx 直接复用 PATH 里
现成的二进制,不再触发网络下载。仅影响 builder 阶段,
不进 runtime scratch 镜像。
2026-07-17 13:33:31 +08:00
xfy
302e05fe1f fix(docker): 补齐 Dockerfile 缺失的 katex-css 与 restore-webp 步骤
Some checks failed
CI / check (push) Has been cancelled
CI / build (push) Has been cancelled
对齐 make build-linux 流水线,修两个同步遗漏:

- katex-css:镜像缺此步导致 $...$/$$...$$ 渲染成裸 span,无 KaTeX
  字体排版。
- restore-webp:dx 0.7.9 会把 public/*.webp 重编码成 VP8L 静图(动画帧
  丢失、体积反增 7-8×),需用源文件覆盖回 dx 产物目录后再拷贝。

两处均在注释中标注 keep in sync with make build-linux。
2026-07-16 18:16:35 +08:00
xfy
71211bc68d chore(docker): GitHub Releases 下载走 gh-proxy 镜像
dx tarball 与 tailwindcss 二进制都在 github.com releases 上,国内下载
~300KB/s 且频繁连接重置。新增 ARG GH_PROXY (默认 https://gh-proxy.com)
前缀到两处 GitHub 下载 URL;传空值可回退直连,便于非大陆环境构建。
2026-07-16 18:03:09 +08:00
xfy
aac0c8198d fix(docker): 升级 builder 至 trixie 以满足 dx 对 GLIBC_2.39 的需求
dx v0.7.9 预编译二进制(both aarch64/x86_64-unknown-linux-gnu)依赖
GLIBC_2.39,而 Debian Bookworm (glibc 2.36) 不满足该要求。
将 builder 阶段基础镜像从 rust:1.96-bookworm 升级至
rust:1.96-trixie (Debian 13, glibc 2.41)。
2026-07-16 17:39:41 +08:00
xfy
f613460742 fix(docker): 修复 DX 下载 case 分支行延续导致的解析失败
Some checks failed
CI / check (push) Has been cancelled
CI / build (push) Has been cancelled
Dockerfile 的 RUN 指令只在行尾有反斜杠时延续到下一行。
DX 下载步骤的 amd64/arm64 分支把 DX_TRIPLET 和 DX_SHA256 拆成两行,
首行缺少续行符,Docker 把次行 DX_SHA256=... 当成新的顶层指令,
报错 unknown instruction: DX_SHA256=...。

改成与同文件其它 case 块(Node/Tailwind/musl)一致的写法:
每个分支单行、以 ;; 收尾。SHA256 值已对照 GitHub 官方 .sha256 旁挂文件核对一致。
2026-07-16 15:15:12 +08:00
xfy
09ca480842 chore(docker): 移除 gh-proxy,改用 GitHub 直连下载 dx 与 Tailwind
Dioxus CLI 与 Tailwind CSS 独立二进制此前经 gh-proxy.com 镜像下载,
现移除 GH_PROXY 前缀及相关注释,直接从 GitHub Releases 拉取。
2026-07-16 14:51:21 +08:00
xfy
f39cb35a31 docs: 补充数学公式与流程图架构说明
AGENTS.md 新增 'Math & Diagrams' 章节详述两条渲染路径:
- KaTeX 服务端渲染:katex-rs + pulldown-cmark ENABLE_MATH + sanitizer span
  白名单 + 自托管 CSS/字体(make katex-css)
- mermaid 客户端懒加载:IntersectionObserver + 动态 import 独立 bundle

同步更新:Server-only deps 加 katex-rs、Frontend Lib 表加 mermaid-renderer 行、
Build Artifacts 加 public/{katex,mermaid}、markdown.rs 描述。
2026-07-16 14:24:38 +08:00
xfy
8c88e82acd fix(docker): make server build arch-aware for multi-arch buildx
Cross-compiling x86_64-unknown-linux-musl from an arm64 buildx leg breaks
ring: cc-rs emits -m64 for the x86_64 target but hands it to Debian's
arm64 musl-gcc (shipped for host arch only), whose cc1 has no -m64 →
'cc1: error: unrecognized command-line option "-m64"'.

Each buildx platform leg now builds its own native musl target
(amd64→x86_64, arm64→aarch64) so musl-gcc and the target always match —
no cross-compiler, no QEMU for the compile step. The built binary is
staged at an arch-independent path so the scratch runtime stage can COPY
it without knowing which target was used.

Makefile gains a docker-multiarch target (buildx --platform
linux/amd64,linux/arm64 --push); 'make docker' now uses buildx --load
for local single-arch testing.
2026-07-10 11:26:03 +08:00
xfy
914562a9e5 feat(docker): route all build downloads through China mirrors
Container内无法访问宿主机的 127.0.0.1:10808 代理(Docker Desktop NAT),
官方源在容器内要么被透明代理截断(NOSPLIT)、要么限速到 16 KB/s。把
所有网络下载源换成国内镜像,实测在容器内:

  - Debian apt   -> TUNA         3.9 MB/s (apt-get update 3s)
  - Node.js 22   -> npmmirror    二进制 mirror,200
  - npm/pnpm     -> npmmirror    registry.npmmirror.com,200
  - Rust/rustup  -> rsproxy.cn   200
  - crates.io    -> rsproxy      sparse index,200
  - Tailwind v4  -> gh-proxy.com 430 KB/s(106MB 完整下载,vs 代理 16KB/s)

镜像地址全部提为 ARG(默认国内源),需要时可 --build-arg 切回官方。
GitHub release 二进制不进宿主代理(大文件限速),单独走国内 GitHub 反代
CDN;GH_PROXY 置空可回退直连。
2026-07-10 10:35:06 +08:00
xfy
0a5dd9c67a fix(docker): use HTTPS Debian mirrors to bypass transparent HTTP interception
A transparent HTTP proxy on the build host (http_proxy=127.0.0.1:10808)
truncates apt's plain-HTTP downloads to a 2578-byte HTML error page, which
apt rejects with 'Clearsigned file isn't valid, got NOSPLIT'. curl/wget
inside the same container fetch the full 151074-byte InRelease fine, and
HTTPS apt sources work — so switch the builder's Debian sources to HTTPS.

Proven by: apt-get update over HTTPS fetched 9264 kB successfully (4m27s
through the throttled proxy); plain HTTP failed with NOSPLIT every time.
2026-07-10 09:41:48 +08:00
xfy
2a7f7be738 chore(docker,ci): Dockerfile 与 CI 切换 pnpm workspace,docs 同步
Dockerfile:
- Node 22 安装段追加 corepack enable + pnpm 11.8.0
- 缓存层从'只 tiptap 的 package.json'扩展为整个 workspace
  (libs/package.json + pnpm-workspace.yaml + pnpm-lock.yaml + 4 lib manifest),
  npm ci 改为 pnpm install --frozen-lockfile,覆盖全部 4 个 lib 的 Docker 层缓存
- 构建步骤 make build-editor 改为 make build-libs

Gitea CI:
- check job 的 Install Node 步骤加装 pnpm,新增 Biome lint 步骤
  (cd libs && pnpm install --frozen-lockfile && pnpm exec biome check .)
- build job 同步装 pnpm,make build 不变(Makefile 已改用 workspace)

.dockerignore: 补齐其余 3 个 lib 的 public 产物 + workspace node_modules 模式

AGENTS.md: Development Commands 删 make clippy、新增 make lint/make fix 说明;
Prerequisites 补 Biome;libs 段改为 pnpm workspace 模型;修正文档漂移
(tt-reveal→tt-expand,eval→Reflect::get)
2026-07-02 18:10:11 +08:00
xfy
ae84c37f21 build: add Dockerfile and .dockerignore for static musl image
Some checks failed
CI / build (push) Has been cancelled
CI / check (push) Has been cancelled
- Multi-stage build using rust:1.96-bookworm builder and scratch runtime.
- Produces a fully statically linked x86_64-unknown-linux-musl server binary.
- Builds frontend assets (Tiptap, Tailwind, Dioxus WASM) and bundles public/.
- Image size ~25 MB; server listens on 0.0.0.0:3000.
2026-06-17 09:48:12 +08:00