| # Use slim Python for a small image | |
| FROM python:3.10-slim | |
| # Prevent Python from buffering stdout/stderr (so you see logs immediately) | |
| ENV PYTHONUNBUFFERED=1 | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy and install only requirements first (leverages Docker cache) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy your application code | |
| COPY . . | |
| EXPOSE 7860 | |
| # Default command: run Uvicorn against your FastAPI app in app.py | |
| # Replace "app:app" if your FastAPI instance is named differently or in another module | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |