FROM python:3.9-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ gcc \ g++ \ make \ && rm -rf /var/lib/apt/lists/* # Create cache directory RUN mkdir -p /.cache && chmod -R 777 /.cache # Set environment variables ENV TRANSFORMERS_CACHE=/.cache ENV HF_HOME=/.cache ENV HUGGINGFACE_HUB_CACHE=/.cache # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY main.py . # Expose port EXPOSE 7860 # Run the API CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]