Spaces:
Sleeping
Sleeping
File size: 1,436 Bytes
a1b31ed da278a5 a1b31ed b582a51 da278a5 a1b31ed da278a5 a5ab062 c6702f5 b8e37ed da278a5 3ef4ce6 b8e37ed 59cd46d 07e5e01 a5ab062 da278a5 a1b31ed da278a5 a1b31ed 07e5e01 a1b31ed 07e5e01 c6702f5 07e5e01 c6702f5 da278a5 c6702f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
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 EVENTLET_NONBLOCKING=1
ENV GUNICORN_TIMEOUT=300
ENV GUNICORN_WORKER_CLASS=eventlet
ENV GUNICORN_WORKERS=1
ENV GUNICORN_WORKER_CONNECTIONS=1000
ENV GUNICORN_KEEP_ALIVE=65
ENV GUNICORN_LOG_LEVEL=debug
# 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
# Create gunicorn config file
RUN echo 'worker_class = "eventlet"' > gunicorn.conf.py && \
echo 'workers = 1' >> gunicorn.conf.py && \
echo 'worker_connections = 1000' >> gunicorn.conf.py && \
echo 'timeout = 300' >> gunicorn.conf.py && \
echo 'keepalive = 65' >> gunicorn.conf.py && \
echo 'loglevel = "debug"' >> gunicorn.conf.py
EXPOSE 7860
# Modified command with explicit configuration
CMD ["gunicorn", \
"--config", "gunicorn.conf.py", \
"--bind", "0.0.0.0:7860", \
"--access-logfile", "-", \
"--error-logfile", "-", \
"app:app"] |