Spaces:
Runtime error
Runtime error
| FROM python:3.10-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE 1 | |
| ENV PYTHONUNBUFFERED 1 | |
| ENV PYTHONPATH=/app/src | |
| ENV HF_HOME=/data/hf_cache | |
| ENV TRANSFORMERS_CACHE=/data/hf_cache/txagent_models | |
| ENV MPLCONFIGDIR=/tmp/matplotlib | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| build-essential \ | |
| libpoppler-cpp-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create and set working directory | |
| WORKDIR /app | |
| # Install base packages | |
| RUN pip install --no-cache-dir \ | |
| packaging \ | |
| setuptools \ | |
| wheel \ | |
| numpy | |
| # Install PyTorch with CUDA support (Hugging Face Spaces provides CUDA) | |
| RUN pip install --no-cache-dir \ | |
| torch \ | |
| transformers \ | |
| sentence-transformers \ | |
| vllm | |
| # Create necessary directories | |
| RUN mkdir -p /data/hf_cache/txagent_models \ | |
| /data/hf_cache/tool_cache \ | |
| /data/hf_cache/cache \ | |
| /data/hf_cache/reports \ | |
| /tmp/matplotlib | |
| # Copy requirements first to leverage Docker cache | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Expose port | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |