#!/bin/sh # Container entrypoint. When RUN_MIGRATIONS=1 (set on the backend service), # apply DB migrations before handing off to the command. This makes a deploy # self-migrating even when images are swapped in place (e.g. by Watchtower), # without a separate orchestration step. `alembic upgrade head` is idempotent — # a no-op when the schema is already current. set -e if [ "${RUN_MIGRATIONS:-0}" = "1" ]; then echo "[entrypoint] applying database migrations (alembic upgrade head)…" uv run --no-dev alembic upgrade head fi exec "$@"