# Dockerfile — unified build for Hugging Face Space FROM python:3.10-slim # Install system deps for building some Python packages RUN apt-get update && apt-get install -y \ build-essential \ gcc \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install Python dependencies first (caching layer) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy all project files COPY . . # Environment defaults (override with HF Secrets) ENV POLYGON_RPC="https://polygon-rpc.com/" ENV DB_PATH="/tmp/pol_indexer.sqlite" ENV SCHEMA_PATH="schema.sql" ENV CONFIRMATIONS="12" # Expose port (Spaces expects 7860 or 8000 usually) EXPOSE 7860 # Run FastAPI app with uvicorn (indexer runs in background thread) CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]