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