init commit
This commit is contained in:
20
docker/entrypoint.sh
Executable file
20
docker/entrypoint.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/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 "$@"
|
||||
Reference in New Issue
Block a user