docker-entrypoint.sh 664 B

12345678910111213141516171819
  1. #!/usr/bin/env bash
  2. # R01-N22: deploy-time migrations.
  3. #
  4. # Apply any pending SQL migrations before Apache starts to serve traffic, so
  5. # the request path can simply CHECK the schema state and refuse to serve when
  6. # something is unexpectedly out of date — no half-applied DDL hazard.
  7. #
  8. # Failure here aborts the container start (we exit non-zero) so the operator
  9. # notices in `docker logs`. Apache otherwise picks up the trailing args
  10. # verbatim (CMD `apache2-foreground`).
  11. set -euo pipefail
  12. APP_ROOT="${APP_ROOT:-/var/www/html}"
  13. echo "[entrypoint] running deploy-time migrations…"
  14. php "${APP_ROOT}/bin/migrate.php"
  15. echo "[entrypoint] starting: $*"
  16. exec "$@"