docker-entrypoint.sh 757 B

123456789101112131415161718192021222324252627
  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. # 清除可能存在的 route 缓存(构建时无 .env 的 route:cache 会导致 Livewire 前缀与运行时不一致)
  17. php artisan route:clear 2>/dev/null || true
  18. echo "Starting PHP-FPM..."
  19. php-fpm -D
  20. echo "PHP-FPM started"
  21. fi
  22. # 执行传入的命令
  23. exec "$@"