feat: 更新 Dockerfile 和启动脚本,改用 Debian slim 基础镜像,增强 Node.js ABI 兼容性检查

This commit is contained in:
cita
2026-03-01 17:52:36 +08:00
parent 05a5ee9b9e
commit 5c1bbd0c62
5 changed files with 60 additions and 12 deletions
+8 -5
View File
@@ -183,7 +183,7 @@ Metapi 作为这些中转站之上的聚合层,把多个站点统一到 **一
### 📦 轻量部署
- **单 Docker 容器**,内置 SQLite,无外部依赖
- Alpine 基础镜像,体积精简
- Debian slim 基础镜像,兼顾兼容性与体积
- 数据完整导入导出,迁移无忧
---
@@ -278,11 +278,14 @@ $env:DATA_DIR="./data"
`start.sh` / `start.bat` 的作用是:
- 先执行数据库迁移:`node dist/server/db/migrate.js`
- 再启动服务:`node dist/server/index.js`
- 先检查 `better-sqlite3` 与当前 Node.js ABI 是否兼容
- 若检测到 ABI 不匹配,会自动尝试 `npm rebuild better-sqlite3`
- 若重建失败,会回退到 `npm ci --omit=dev` 重新安装运行时依赖
- 最后执行数据库迁移并启动服务
> [!NOTE]
> Release 包依赖本机安装 Node.js(建议 20+)。
> Release 包依赖本机安装 Node.js(支持 20+,推荐 22 LTS)。
> 如果本机 Node 主版本与打包时不同(例如包内依赖基于 Node 22,而本机是 Node 24),首次启动可能触发自动重建,需联网。
### 升级
@@ -496,7 +499,7 @@ location / {
| **数据库** | SQLite ([better-sqlite3](https://github.com/WiseLibs/better-sqlite3)) + [Drizzle ORM](https://orm.drizzle.team) |
| **数据可视化** | [VChart](https://visactor.io/vchart) (@visactor/react-vchart) |
| **定时任务** | [node-cron](https://github.com/node-cron/node-cron) |
| **容器化** | Docker (Alpine) + Docker Compose |
| **容器化** | Docker (Debian slim) + Docker Compose |
| **测试** | [Vitest](https://vitest.dev) |
---