# Use a lightweight Python base FROM python:3.11-slim # Set up a new user to comply with Hugging Face's security policy RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:${PATH}" WORKDIR /home/user/app # Install system dependencies USER root RUN apt-get update && apt-get install -y \ git \ curl \ && rm -rf /var/lib/apt/lists/* USER user # Clone the Agent Zero repository RUN git clone https://github.com/frdel/agent-zero.git . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Create necessary directories for persistence and logs RUN mkdir -p /home/user/app/workspaces /home/user/app/logs # Expose the port (Hugging Face Spaces usually use 7860) EXPOSE 7860 # Set environment variables (Can also be set in HF Space Settings) ENV PYTHONUNBUFFERED=1 # Command to run the agent # Note: You may need to modify the entry point depending on how you want to interact (CLI vs API) CMD ["python", "main.py"]