# Use an official lightweight Python image FROM python:3.10-slim # Set the working directory in the container WORKDIR /app # Copy the requirements file first to leverage Docker cache COPY requirements.txt . # Install dependencies without caching to keep the image slim RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application code COPY main.py . # Expose the port the app runs on EXPOSE 5000 # Command to run the Uvicorn server for production # We use main:app to specify the file (main.py) and the FastAPI instance (app) CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000"]