fix: make update container scripts readable after restrictive ZIP extraction

This commit is contained in:
Codex
2026-10-24 14:32:16 +08:00
parent eb478a6e13
commit 2f11a8c904
2 changed files with 15 additions and 1 deletions
+10
View File
@@ -32,6 +32,16 @@ docker compose run --rm --no-deps updates python manage.py
按提示输入至少12位后台密码并再次确认。工具会输出 `ADMIN_PASSWORD_HASH='…'` 和 `SESSION_SECRET='…'` 两行。只在服务器将这两行填入 `.env` 的对应位置,保留单引号,避免Docker把密码哈希中的 `$` 当作变量。不要把输出或密码发到聊天中。
如果旧部署包在这一步报`python: can't open file '/app/manage.py': [Errno 13] Permission denied`,原因是旧压缩包的程序文件权限为600,而容器使用普通用户运行。只需将本次修正包的`Dockerfile`覆盖到原部署目录(保留`.env`和数据卷),然后执行:
```sh
cd /opt/tpschedule-updates
docker compose build updates
docker compose run --rm --no-deps updates python manage.py
```
修正的Dockerfile在切换普通用户前将`/app`设为755、四个程序/依赖清单文件设为644,不改变`.env`权限。无需把容器改为root,也无需给整个目录设置777。若服务已启动,完成配置后执行`docker compose up -d`,使其使用新镜像。
`.env`其他项目:
```dotenv