Files
celtic-life-science/scripts/docker-entrypoint.sh
Shubhankar45 8fdd20b29f Production
2026-09-22 06:23:46 +00:00

21 lines
655 B
Bash
Executable File

#!/bin/sh
# Container entrypoint: bring the schema up to date, then hand over to the server.
# Migrations are idempotent, so restarting the container is always safe. Data import
# scripts (which replace table contents) are never run from here.
set -eu
if [ "${RUN_MIGRATIONS:-1}" = "1" ]; then
attempt=1
until alembic upgrade head; do
if [ "$attempt" -ge 15 ]; then
echo "entrypoint: database migration failed after $attempt attempts" >&2
exit 1
fi
echo "entrypoint: database not ready (attempt $attempt), retrying in 3s" >&2
attempt=$((attempt + 1))
sleep 3
done
fi
exec "$@"