# Dockerfile (نسخه نهایی و بهینه شده) # Use an official Python runtime as a parent image FROM python:3.9-slim # Set the working directory in the container WORKDIR /app # Copy requirements first for better caching COPY requirements.txt . # Install dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application's code COPY . . # <<< تغییر کلیدی: یک پوشه قابل نوشتن و مجزا برای فایل‌های موقت ایجاد می‌کنیم >>> RUN mkdir -p /app/tmp && chmod 777 /app/tmp # Expose the port the app runs on EXPOSE 7860 # <<< تغییر کلیدی: بهینه سازی برای پردازش همزمان کاربران بیشتر >>> # Run app.py when the container launches CMD ["gunicorn", "--workers", "2", "--threads", "4", "--bind", "0.0.0.0:7860", "app:app"]