FROM python:3.10-slim # Install system dependencies # build-essential is needed for some ML package wheels # redis-server is needed for the local Semantic Caching layer RUN apt-get update && apt-get install -y \ build-essential \ redis-server \ && rm -rf /var/lib/apt/lists/* # Set up a new user named "user" with user ID 1000 (Mandatory for Hugging Face Spaces) RUN useradd -m -u 1000 user # Switch to the "user" user USER user # Set home to the user's home directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Copy the current directory contents into the container COPY --chown=user . $HOME/app # Install pip and the LLMOpt package with all ML dependencies RUN pip install --no-cache-dir --upgrade pip RUN pip install --no-cache-dir -e ".[ml]" # Make the start script executable RUN chmod +x $HOME/app/start.sh # Expose the standard Hugging Face port EXPOSE 7860 # Run the unified start script CMD ["./start.sh"]