FROM python:3.10-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* # Upgrade pip first RUN pip install --upgrade pip # Copy requirements and install Python dependencies COPY requirements.txt . # Install packages separately for better caching and reliability RUN pip install --default-timeout=1000 --no-cache-dir flask flask-cors RUN pip install --default-timeout=1000 --no-cache-dir transformers==4.42.4 RUN pip install --default-timeout=1000 --no-cache-dir torch==2.3.1 # Copy application code COPY app.py . # Copy templates folder COPY templates/ ./templates/ # Copy model files COPY models/ ./models/ # Expose port EXPOSE 7860 # Run the application CMD ["python", "app.py"]