# RedCell API — container for Render / Railway / any host.
FROM python:3.12-slim

WORKDIR /app

# Install the package (API extra). Build context is the repo root.
COPY pyproject.toml README.md ./
COPY redcell ./redcell
COPY examples ./examples
RUN pip install --no-cache-dir ".[api]"

# Persist the SQLite DB under /data (mount a volume for durability; ephemeral otherwise).
ENV REDCELL_DB=/data/redcell.db
RUN mkdir -p /data

EXPOSE 8000

# Hosts inject $PORT; default to 8000 locally.
CMD ["sh", "-c", "uvicorn redcell.api.app:app --host 0.0.0.0 --port ${PORT:-8000}"]
