# Build from the repository root (the AI coach package lives next to the backend): # docker build -f backend/Dockerfile -t cognivision-backend . FROM python:3.11-slim ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1 WORKDIR /srv COPY AI-coach-agent /opt/ai-coach-agent RUN pip install /opt/ai-coach-agent COPY backend/pyproject.toml backend/alembic.ini ./ COPY backend/app ./app COPY backend/migrations ./migrations RUN pip install . "google-auth[requests]>=2.30" COPY backend/start-backend.sh /srv/start-backend.sh RUN useradd --uid 1000 --create-home app USER app EXPOSE 8000 # Migrations run as a separate release step: docker run ... alembic upgrade head # Behind a proxy, set FORWARDED_ALLOW_IPS to the proxy's address only (never "*"), or clients can spoof their IP # and get around the per-IP login limits. ENV FORWARDED_ALLOW_IPS=127.0.0.1 CMD ["sh", "/srv/start-backend.sh"]