FROM python:3.12-slim # Install system dependencies RUN apt-get update && apt-get install -y \ git \ curl \ build-essential \ libopenblas-dev \ nodejs \ npm \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Install llama-cpp-python with OpenBLAS and Streamlit RUN pip install llama-cpp-python[server] streamlit # Download Qwen2.5-Coder-3B-Instruct GGUF Q4_K_M RUN mkdir -p /app/models RUN curl -L -o /app/models/qwen2.5-coder-3b-instruct-q4_k_m.gguf https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct-GGUF/resolve/main/qwen2.5-coder-3b-instruct-q4_k_m.gguf # Install Claude Code globally RUN npm install -g @anthropic-ai/claude-code # Create a dummy config.toml for OpenManus if needed, or just for structure RUN mkdir -p /app/config RUN echo '[llm]\nmodel = "qwen2.5-coder"\nbase_url = "http://localhost:8001/v1"\napi_key = "not-needed"\nmax_tokens = 4096\ntemperature = 0.0\n' > /app/config/config.toml # Copy our custom GUI for Claude Code COPY app_claude_code_gui.py /app/app_claude_code_gui.py # Create a startup script RUN echo '#!/bin/bash\n\ # Start llama-cpp-python server in background\n\ python3 -m llama_cpp.server --model /app/models/qwen2.5-coder-3b-instruct-q4_k_m.gguf --host 0.0.0.0 --port 8001 &\n\ \n\ # Wait for server to start\n\ until curl -s http://localhost:8001/v1/models > /dev/null; do\n\ echo "Waiting for LLM server..."\n\ sleep 5\n\ done\n\ \n\ # Start Streamlit UI on port 7860\n\ streamlit run app_claude_code_gui.py --server.port 7860 --server.address 0.0.0.0\n\ ' > /app/start.sh && chmod +x /app/start.sh # HF Spaces expect a web service on port 7860 EXPOSE 7860 CMD ["/app/start.sh"]