21 lines
678 B
Bash
Executable File
21 lines
678 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
echo "[entrypoint] Waiting for MariaDB at ${DB_HOST:-db}:${DB_PORT:-3306}..."
|
|
until mariadb -h "${DB_HOST:-db}" -P "${DB_PORT:-3306}" -u"${DB_USER:-root}" -p"${DB_PASSWORD:-}" -e "SELECT 1" >/dev/null 2>&1; do
|
|
sleep 1
|
|
done
|
|
echo "[entrypoint] MariaDB is up"
|
|
|
|
if [ "${RUN_MIGRATIONS:-true}" = "true" ]; then
|
|
if [ -f "/app/alembic.ini" ] && [ -d "/app/migrations" ]; then
|
|
echo "[entrypoint] Running alembic upgrade head"
|
|
alembic upgrade head || echo "[entrypoint] Alembic failed (non-fatal)"
|
|
else
|
|
echo "[entrypoint] Skipping alembic — no /app/migrations or alembic.ini"
|
|
fi
|
|
fi
|
|
|
|
echo "[entrypoint] Starting: $*"
|
|
exec "$@"
|