构建: 入口脚本 chown 数据目录后降权运行

绑定挂载/命名卷被 docker 以 root 自动创建时,容器非 root 用户
写不进 db(SQLITE_CANTOPEN)。改为 entrypoint 以 root 启动,
chown 数据目录到 OT_UID:OT_GID(默认 1000:1000)后 su-exec 降权,
compose 不再需要 user: 覆盖。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Sakurasan
2026-08-18 22:25:43 +08:00
co-authored by Claude
parent 5aa0be13dc
commit 8495694671
3 changed files with 20 additions and 6 deletions
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# openteam 容器入口:以 root 短暂启动,修正数据目录属主后降权执行服务。
# 解决绑定挂载/命名卷被 docker 以 root 自动创建、应用非 root 用户写不进 db 的问题。
set -e
PUID="${OT_UID:-1000}"
PGID="${OT_GID:-1000}"
mkdir -p /app/data
chown -R "${PUID}:${PGID}" /app/data
exec su-exec "${PUID}:${PGID}" "$@"