Spaces:
Running
Running
File size: 918 Bytes
99be9aa | 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 | # Base Python image
FROM python:3.10-slim
# Environment settings to avoid Python cache & force unbuffered output
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set working directory
WORKDIR /app
# Install system dependencies (for building some Python packages)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first (better Docker caching)
COPY requirements.txt requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt gunicorn
# Copy the entire project (including subfolders)
COPY . .
# Hugging Face Spaces default exposed port
EXPOSE 7860
# Run Flask with Gunicorn for parallel processing
# app:app means 'app.py' file and 'app' Flask instance inside it
CMD ["gunicorn", "--workers", "4", "--threads", "12", "--bind", "0.0.0.0:7860", "app:app"] |