# Base Image FROM python:3.10-slim ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 WORKDIR /code # System Dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ curl \ libopenblas-dev \ libomp-dev \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Hugging Face + model tools RUN pip install --no-cache-dir huggingface-hub sentencepiece accelerate sacremoses # Hugging Face cache environment (using /tmp for runtime downloads) ENV HF_HOME=/tmp/huggingface \ TRANSFORMERS_CACHE=/tmp/huggingface \ HUGGINGFACE_HUB_CACHE=/tmp/huggingface \ HF_HUB_CACHE=/tmp/huggingface # Create cache dir with proper permissions (using /tmp for Hugging Face Spaces) RUN mkdir -p /tmp/huggingface && \ chmod -R 777 /tmp/huggingface # Models will be downloaded at runtime to avoid exceeding storage limit # Copy project files COPY . . # Expose agent port EXPOSE 7860 CMD ["python", "app.py"]