FROM python:3.11-slim

WORKDIR /app
ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1

COPY backend/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt uvicorn

COPY backend/ /app/
# §20.1: health.py reads the canonical VERSION file from the repo root
# (parents[2] of backend/app/health.py). In the image that resolves to
# /VERSION, so the file must be copied there or backend import crashes.
COPY VERSION /VERSION

RUN mkdir -p /data
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
