FROM python:3.12-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY *.py ./

# Create data directory for SQLite (used locally; Fly mounts a volume at /data)
RUN mkdir -p /data

EXPOSE 8080

CMD ["sh", "-c", "python3 -m uvicorn api_server:app --host 0.0.0.0 --port ${PORT:-8080}"]
