Spaces:
Sleeping
Sleeping
File size: 654 Bytes
6776042 5ff4b5a 6776042 5ff4b5a 6776042 5ff4b5a 6776042 5ff4b5a 6776042 5ff4b5a 6776042 | 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 | # Use the official lightweight Python image
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /app
# Copy requirements first
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
# Create a non-root user (Security Best Practice for HF Spaces)
RUN useradd -m -u 1000 user
USER user
# HF Spaces Port
ENV PORT=7860
EXPOSE 7860
# FIXED CMD: Use 'gthread' worker to handle async I/O within Flask
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--threads", "4", "--worker-class", "gthread", "--timeout", "120", "app:app"] |