| # Use Python 3.10 slim image as the base image | |
| FROM python:3.10-slim | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Install system dependencies (optional, depending on the need for certain Python packages) | |
| RUN apt-get update && apt-get install -y build-essential git && rm -rf /var/lib/apt/lists/* | |
| # Copy all project files into the working directory | |
| COPY . . | |
| # Upgrade pip and install dependencies | |
| RUN pip install --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Expose the port FastAPI will run on (update to match the port in your uvicorn command) | |
| EXPOSE 8000 | |
| # Run the FastAPI app using uvicorn with 4 workers | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"] | |