docker-entrypoint.sh 582 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. set -e
  3. # 修复 storage 目录权限(挂载卷可能覆盖权限)
  4. if [ -d /app/storage ]; then
  5. chmod -R 777 /app/storage 2>/dev/null || true
  6. chmod -R 777 /app/bootstrap/cache 2>/dev/null || true
  7. fi
  8. # 启动 dbus 守护进程(Chrome 需要)
  9. if [ -x /usr/bin/dbus-daemon ]; then
  10. mkdir -p /run/dbus
  11. rm -f /run/dbus/pid
  12. dbus-daemon --system --fork 2>/dev/null || true
  13. fi
  14. # 启动 PHP-FPM(后台运行)
  15. if [ "$1" = "nginx" ]; then
  16. echo "Starting PHP-FPM..."
  17. php-fpm -D
  18. echo "PHP-FPM started"
  19. fi
  20. # 执行传入的命令
  21. exec "$@"