| # Dockerfile | |
| # Use the official, full Python image for best compatibility | |
| FROM python:3.11 | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Install system dependencies listed in packages.txt | |
| COPY packages.txt . | |
| RUN apt-get update && xargs -a packages.txt apt-get install -y --no-install-recommends && apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Copy and install Python requirements | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of your application code | |
| COPY . . | |
| # --- THIS IS THE DEFINITIVE STARTUP COMMAND --- | |
| # It tells the container exactly how to run the web server. | |
| # Gunicorn is a robust process manager for production. | |
| # It uses Uvicorn workers to handle the async FastAPI code. | |
| # It binds to port 7860 on all network interfaces. | |
| CMD ["gunicorn", "-w", "2", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "app:app"] |