FROM python:3.11-slim WORKDIR /app # substrate-interface requires py-sr25519-bindings which compiles Rust extensions. # Install build toolchain first. RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ pkg-config \ libssl-dev \ curl \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ --default-toolchain stable \ --profile minimal \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* ENV PATH="/root/.cargo/bin:${PATH}" # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application COPY app.py . # Expose port (Hugging Face Spaces uses 7860) EXPOSE 7860 # Environment variables (set these in Hugging Face Spaces settings) # REAL_API_URL should be set as a secret ENV PORT=7860 ENV RATE_LIMIT_PER_MINUTE=20 # Run the app CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--proxy-headers", "--forwarded-allow-ips", "*"]