# Use a lightweight Python base image FROM python:3.10-slim # Set environment variables for HuggingFace Transformers cache ENV HF_HOME=/tmp/hf-cache \ PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 # Set working directory inside the container WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # Copy only requirements first to leverage Docker layer caching COPY requirements.txt . # Install Python dependencies RUN pip install --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # Copy the rest of the application code COPY . . # Create cache directory (if not created by app itself) #RUN mkdir -p /app/cache # Expose FastAPI's default port EXPOSE 7860 # Run the FastAPI app with Uvicorn CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"]