# Use a slim and modern Python base image FROM python:3.11-slim # Set the working directory inside the container WORKDIR /app # Copy the requirements file first to leverage Docker's layer caching COPY requirements.txt . # Install dependencies, including build tools for uvloop, then clean up # --no-cache-dir reduces image size RUN apt-get update && apt-get install -y build-essential && \ pip install --no-cache-dir -r requirements.txt && \ apt-get purge -y --auto-remove build-essential && \ rm -rf /var/lib/apt/lists/* # Copy the rest of the application code COPY phoenix_fury_api.py . # Expose the port the API will run on EXPOSE 8000 # Set the command to run the application using uvicorn # Using --workers 1 because we are managing parallelism with multiprocessing in Python CMD ["uvicorn", "phoenix_fury_api:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]