FROM python:3.13-slim # Install system dependencies required by fast-agent and HF Spaces RUN apt-get update && \ apt-get install -y \ bash \ git git-lfs \ wget curl procps \ && rm -rf /var/lib/apt/lists/* # Install uv for fast, reliable package management COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv # Set working directory WORKDIR /app # Install fast-agent-mcp from PyPI RUN uv pip install --system --no-cache fast-agent-mcp # Copy all files from the Space repository to /app COPY --link ./ /app # Ensure /app is owned by uid 1000 (required for HF Spaces) RUN chown -R 1000:1000 /app # Switch to non-root user USER 1000 # Expose port 7860 (HF Spaces default) EXPOSE 7860 # Run fast-agent serve with request-scoped instances for token passthrough CMD ["fast-agent", "serve", "--card", "hf_hub_community.md", "--transport", "http", "--instance-scope", "request", "--host", "0.0.0.0", "--port", "7860"]