# Use an official Python runtime as a parent image FROM python:3.10-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV TRANSFORMERS_CACHE=/app/cache ENV HF_HOME=/app/cache # Set work directory WORKDIR /app RUN mkdir -p /app/cache && chmod -R 777 /app/cache # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ git \ && rm -rf /var/lib/apt/lists/* # Copy requirements.txt COPY requirements.txt /app/ # Install Python dependencies RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt # Copy project files COPY . /app/ # Expose port EXPOSE 7860 # Run the FastAPI app with Uvicorn CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]