1459
This commit is contained in:
1 parent
4ab47a3e47
commit
ba016efbe8
21 files changed
+921
-72
No files matched your search
@@ -1,6 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Docker entrypoint script
|
||||
# 修复挂载目录权限后以 nextjs 用户启动应用
|
||||
|
||||
# 创建必要的子目录(以 root 身份)
|
||||
mkdir -p /app/recycle/posts /app/recycle/meta /app/logs /app/backups
|
||||
@@ -8,13 +7,21 @@ mkdir -p /app/recycle/posts /app/recycle/meta /app/logs /app/backups
|
||||
# 修复 recycle 目录权限
|
||||
chown -R nextjs:nodejs /app/recycle /app/logs /app/backups
|
||||
|
||||
# 修复博客目录权限(让 nextjs 用户可写)
|
||||
# 自动哈希明文密码(users.json 中没有 salt 字段时)
|
||||
if [ -f "/app/users.json" ]; then
|
||||
if ! grep -q '"salt"' /app/users.json 2>/dev/null; then
|
||||
echo "[entrypoint] 检测到明文密码,自动哈希..."
|
||||
node /app/scripts/hash-users.js
|
||||
echo "[entrypoint] 密码哈希完成"
|
||||
fi
|
||||
fi
|
||||
|
||||
# 修复博客目录权限
|
||||
if [ -d "/blog" ]; then
|
||||
# 博客根目录及其所有文件
|
||||
chown -R nextjs:nodejs /blog
|
||||
fi
|
||||
|
||||
# 配置 git(容器内 nextjs 用户)
|
||||
# 配置 git
|
||||
su-exec nextjs git config --global user.name "Write Server" 2>/dev/null
|
||||
su-exec nextjs git config --global user.email "write@usj.cc" 2>/dev/null
|
||||
su-exec nextjs git config --global --add safe.directory /blog 2>/dev/null
|
||||
|
||||
Reference in new issue
Block a user