MoviePilot/entrypoint
2023-08-16 20:20:44 +08:00

33 lines
976 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 使用 `envsubst` 将模板文件中的 ${NGINX_PORT} 替换为实际的环境变量值
envsubst '${NGINX_PORT}' < /etc/nginx/nginx.template.conf > /etc/nginx/nginx.conf
# 自动更新
if [ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]; then
cd /
/usr/local/bin/mp_update
cd /app
else
echo "程序自动升级已关闭如需自动升级请在创建容器时设置环境变量MOVIEPILOT_AUTO_UPDATE=true"
fi
# 更改 moviepilot userid 和 groupid
groupmod -o -g ${PGID} moviepilot
usermod -o -u ${PUID} moviepilot
# 更改文件权限
chown -R moviepilot:moviepilot \
${HOME} \
/app \
/public \
/config \
/var/lib/nginx \
/var/log/nginx
chown moviepilot:moviepilot /etc/hosts /tmp
# 下载浏览器内核
gosu moviepilot:moviepilot playwright install chromium
# 启动前端nginx服务
nginx
# 设置后端服务权限掩码
umask ${UMASK}
# 启动后端服务
exec dumb-init gosu moviepilot:moviepilot python3 app/main.py