entrypoint.sh 639 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. set -eu
  3. mode="${1:-api}"
  4. # Ensure the SQLite data dir exists when DB_SQLITE_PATH is configured.
  5. if [ -n "${DB_SQLITE_PATH:-}" ]; then
  6. sqlite_dir="$(dirname "$DB_SQLITE_PATH")"
  7. mkdir -p "$sqlite_dir"
  8. fi
  9. case "$mode" in
  10. api)
  11. exec frankenphp run --config /etc/Caddyfile
  12. ;;
  13. migrate)
  14. cd /app
  15. # Empty migrations dir is fine — phinx exits 0 with "no migrations to run".
  16. exec vendor/bin/phinx migrate --configuration=config/phinx.php
  17. ;;
  18. *)
  19. echo "Unknown mode: $mode" >&2
  20. echo "Usage: entrypoint.sh [api|migrate]" >&2
  21. exit 1
  22. ;;
  23. esac