Spaces:
Running
Running
| # Research Agent web service — runs the full Python agent on Cloud Run. | |
| FROM python:3.11-slim | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| HF_HOME=/app/.hf \ | |
| TOKENIZERS_PARALLELISM=false | |
| WORKDIR /app | |
| # CPU-only torch first so sentence-transformers doesn't drag in CUDA wheels. | |
| RUN pip install --index-url https://download.pytorch.org/whl/cpu "torch>=2.2" | |
| # Project + web deps (installs all runtime dependencies from pyproject). | |
| COPY pyproject.toml README.md ./ | |
| COPY src ./src | |
| RUN pip install ".[server]" | |
| # Bake the embedding model into the image so cold starts don't fetch it. | |
| RUN python -c "from sentence_transformers import SentenceTransformer; \ | |
| SentenceTransformer('all-MiniLM-L6-v2')" | |
| COPY server ./server | |
| # Default to 7860 (Hugging Face Spaces' expected port). Cloud Run overrides | |
| # $PORT to 8080 at runtime, so this image runs on both unchanged. | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| CMD exec uvicorn server.app:app --host 0.0.0.0 --port ${PORT} | |