FROM python:3.9-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ && rm -rf /var/lib/apt/lists/* # Set up cache directory RUN mkdir -p /app/cache && chmod -R 777 /app/cache ENV HF_HOME=/app/cache # Set environment variables for proper eventlet operation ENV PYTHONUNBUFFERED=1 ENV EVENTLET_NO_GREENDNS=yes ENV EVENTLET_THREADPOOL_SIZE=32 ENV EVENTLET_WEBSOCKET_MONITOR_TIMEOUT=60 ENV GUNICORN_CMD_ARGS="--worker-class eventlet --workers 1 --timeout 300 --keep-alive 65 --log-level debug --access-logfile - --error-logfile -" # Copy application files COPY . /app # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip RUN pip install --no-cache-dir -r requirements.txt # Expose port EXPOSE 7860 # Modified command to use explicit configuration CMD ["gunicorn", \ "--worker-class", "eventlet", \ "--workers", "1", \ "--worker-connections", "1000", \ "--timeout", "300", \ "--keep-alive", "65", \ "--bind", "0.0.0.0:7860", \ "--log-level", "debug", \ "--access-logfile", "-", \ "--error-logfile", "-", \ "app:app"]