Skip to content

fix(docker): add build dependencies for better-sqlite3 native compilation

刘福春 requested to merge fix/20260525-dockerfile-build-deps into main

Summary

CI 构建失败,npm ci 时报 better-sqlite3 编译错误。

根因node:20-alpine 最小镜像缺少编译原生 C++ 模块所需的工具(python3build-base),导致 node-gyp 编译 better-sqlite3 失败。

修复:在 builder 阶段加入 RUN apk add --no-cache python3 build-base,这些工具仅在编译阶段使用,runner 阶段不受影响。

Test plan

  • CI 构建通过
  • Docker build 本地验证

🤖 配合 Claude Code 生成

Merge request reports