#!/bin/sh
set -e

# Only the web (gunicorn) container should run migrations / collectstatic.
# The celery worker shares this image but skips DB schema mutation to avoid races.
case "$1" in
  gunicorn)
    echo "[entrypoint] running migrations..."
    python manage.py migrate --noinput
    echo "[entrypoint] collecting static..."
    python manage.py collectstatic --noinput
    ;;
esac

exec "$@"
