Files
blog/write-server/entrypoint.sh
T
2026-06-21 23:28:31 +08:00

24 lines
646 B
Bash

#!/bin/sh
# Docker entrypoint script
# 修复挂载目录权限后以 nextjs 用户启动应用
# 创建必要的子目录(以 root 身份)
mkdir -p /app/recycle/posts /app/recycle/meta /app/logs /app/backups
# 修复 recycle 目录权限
chown -R nextjs:nodejs /app/recycle /app/logs /app/backups
# 修复博客目录权限(让 nextjs 用户可写)
if [ -d "/blog/content" ]; then
chown -R nextjs:nodejs /blog/content
fi
if [ -d "/blog/static" ]; then
chown -R nextjs:nodejs /blog/static
fi
if [ -f "/blog/hugo.toml" ]; then
chown nextjs:nodejs /blog/hugo.toml
fi
# 以 nextjs 用户启动应用
exec su-exec nextjs "$@"