# Use the official Python image FROM python:3.9-slim # Set the working directory inside the container WORKDIR /app # Copy the requirements file COPY requirements.txt . # Install dependencies # --no-cache-dir keeps the image small RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the app code (main.py and .pkl files) COPY . . # Create a generic user (Hugging Face requirement for security) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Expose the port (Hugging Face uses 7860 by default) EXPOSE 7860 # Run the application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]