questfeed's picture
Fix gunicorn --keep-alive argument (was --keepalive)
fd8b71c
Raw History Blame Contribute Delete
860 Bytes
# Dockerfile for Hugging Face Spaces deployment
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Copy requirements file
COPY requirements-hf.txt requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY app.py .
COPY .env.example .env
# Expose Hugging Face Spaces default port
EXPOSE 7860
# Set environment variables for production
ENV PORT=7860
ENV DEBUG=False
ENV PYTHONUNBUFFERED=1
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:7860/health', timeout=5)" || exit 1
# Run the application with gunicorn
CMD ["gunicorn", "app:server", "--bind", "0.0.0.0:7860", "--workers", "2", "--threads", "4", "--timeout", "120", "--keep-alive", "5", "--log-level", "info"]