-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
80 lines (65 loc) · 3.26 KB
/
Dockerfile
File metadata and controls
80 lines (65 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# OpenHands LLM Enhancement
# Adds local LLM support and semantic code search to official OpenHands
FROM docker.openhands.dev/openhands/openhands:latest
USER root
# Install dependencies:
# - curl, dos2unix, gosu: general utilities
# - docker.io: Docker CLI needed to build sandbox runtime images
RUN apt-get update && apt-get install -y curl dos2unix gosu docker.io && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install llm-tldr: advanced code analysis (CFG, DFG, call graphs, semantic search, daemon)
# CPU-only torch keeps the image ~1.5GB smaller than GPU version
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \
pip install --no-cache-dir llm-tldr ruff
# Install tldr-code: basic signature extraction (Pygments, 40+ languages)
# Installed to separate dir to avoid module conflict (both packages use 'tldr' module name)
RUN pip install --no-cache-dir --target /app/tldr_code_lib --no-deps \
git+https://github.com/csimoes1/tldr-code.git && \
pip install --no-cache-dir --target /app/tldr_code_lib --no-deps pygments-tldr && \
INIT_FILE="/app/tldr_code_lib/tldr/__init__.py" && \
sed -i 's/import toml/__version__ = "0.1.2"/' "$INIT_FILE" && \
sed -i '/__version__ = toml.load/d' "$INIT_FILE"
# Wrapper CLI for sandbox agent use (invokes tldr-code via PYTHONPATH)
COPY tools/tldr /app/tools/tldr
RUN dos2unix /app/tools/tldr && chmod +x /app/tools/tldr
# Create directories (/.openhands is where OpenHands stores JWT secret + file store)
RUN mkdir -p /app/local_llm /app/hooks /.openhands && \
chown -R openhands:openhands /app/local_llm /app/hooks /.openhands
# Copy Python files (hook classifier, semantic search)
COPY local_llm/hook_classifier.py /app/local_llm/hook_classifier.py
COPY local_llm/openhands_semantic_hook.py /app/local_llm/openhands_semantic_hook.py
COPY local_llm/code_semantic_search.py /app/local_llm/code_semantic_search.py
# Copy hooks
COPY hooks/semantic_code_hook.sh /app/hooks/semantic_code_hook.sh
COPY hooks/code_checker.sh /app/hooks/code_checker.sh
COPY hooks/error_analyzer.sh /app/hooks/error_analyzer.sh
COPY hooks/context_injector.sh /app/hooks/context_injector.sh
COPY hooks/test_hook.sh /app/hooks/test_hook.sh
RUN chmod +x /app/hooks/*.sh
# Copy hook configuration
COPY hooks.json /app/hooks.json
# Copy microagents (loaded by V0 web UI for agent instructions)
RUN mkdir -p /app/microagents
COPY microagents/ /app/microagents/
# Copy V1 project skills and AGENTS.md template
RUN mkdir -p /app/skills
COPY skills/ /app/skills/
COPY AGENTS.md.template /app/AGENTS.md.template
# Copy validation tools
COPY tools/validate_llm.py /app/tools/validate_llm.py
# Copy entrypoint
COPY entrypoint.sh /app/entrypoint.sh
RUN dos2unix /app/entrypoint.sh && chmod +x /app/entrypoint.sh
# Environment variable defaults
ENV LLM_MODEL=deepseek/deepseek-reasoner
ENV LLM_API_KEY=""
ENV LLM_BASE_URL=https://api.deepseek.com
ENV OLLAMA_HOST=http://host.docker.internal:11434
ENV HOOKS_MODEL=ollama/qwen3.5:27b
ENV HOOKS_BASE_URL=""
ENV HOOKS_API_KEY=""
ENV EMBEDDING_MODEL=nomic-embed-text
ENV TLDR_MODE=both
ENV TLDR_ROUTING=auto
# Entrypoint runs as root to fix docker socket perms, then drops to openhands
CMD ["/app/entrypoint.sh"]