-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile.oh
More file actions
68 lines (62 loc) · 3.71 KB
/
Copy pathDockerfile.oh
File metadata and controls
68 lines (62 loc) · 3.71 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
# Runner image for claw-anything + vanilla OpenHarness (trial-in-container sandbox mode).
# Build via: scripts/build_oh_image.sh
#
# Differs from Dockerfile.oh_ext: no OH-Ext source copy, no adb binary —
# vanilla OH has no GUI/mobile plugin and trials using this image cannot drive
# Android. For GUI tasks build claw-anything-oh-ext:latest instead.
#
# Override registry at build time if needed:
# docker build --build-arg REGISTRY=docker.io -f Dockerfile.oh .
ARG REGISTRY=docker.m.daocloud.io
FROM ${REGISTRY}/python:3.11-slim
WORKDIR /opt/claw-anything
# ── claw-anything ────────────────────────────────────────────────────────────
# Install dependencies first (separate layer for better cache reuse).
COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt \
-i https://pypi.tuna.tsinghua.edu.cn/simple \
--trusted-host pypi.tuna.tsinghua.edu.cn \
--no-cache-dir \
&& rm /tmp/requirements.txt
# Install claw-anything package (src/ + mock_services/ copied by build script).
COPY claw-anything/pyproject.toml /opt/claw-anything/pyproject.toml
COPY claw-anything/src /opt/claw-anything/src
COPY claw-anything/mock_services /opt/claw-anything/mock_services
RUN pip install -e /opt/claw-anything \
-i https://pypi.tuna.tsinghua.edu.cn/simple \
--trusted-host pypi.tuna.tsinghua.edu.cn \
--no-cache-dir
# ── OpenHarness (vanilla, from PyPI) ─────────────────────────────────────────
# 0.1.9 is the first upstream release where PluginManifest has ``tools_dir``
# (LoadedPlugin gains a ``tools`` list) — without it the claw-anything plugin
# loads but its tools are silently dropped, so the model only sees OH's
# builtin set. Do not downgrade below 0.1.9.
# Fallback to PyPI default index if the tsinghua mirror is missing the package.
RUN pip install 'openharness-ai==0.1.9' \
-i https://pypi.tuna.tsinghua.edu.cn/simple \
--trusted-host pypi.tuna.tsinghua.edu.cn \
--no-cache-dir \
|| pip install 'openharness-ai==0.1.9' --no-cache-dir
# ── Build-time patches for openharness-ai 0.1.9 ──────────────────────────────
# Each script does a single OLD→NEW string substitution in the installed OH
# source and raises if the anchor line is gone, so a future openharness-ai
# bump fails the build loudly instead of silently regressing behaviour.
# See each ``docker/oh/patch_*.py`` for the specific upstream line it edits
# and why.
# - patch_print_mode_usage.py → emit ``usage`` in stream-json assistant_complete
# - patch_openai_client.py → keep ``stream_options`` so per-turn usage chunks arrive
# - patch_environment_date.py → honour ``CLAW_TASK_EXECUTION_DATE`` env var
# - patch_system_prompt_suffix.py → append ``CLAW_SYSTEM_PROMPT_SUFFIX`` (activity logs)
# - patch_emit_system_prompt.py → emit final system prompt as a stream-json event
COPY oh/patch_print_mode_usage.py /tmp/patch_print_mode_usage.py
COPY oh/patch_openai_client.py /tmp/patch_openai_client.py
COPY oh/patch_environment_date.py /tmp/patch_environment_date.py
COPY oh/patch_system_prompt_suffix.py /tmp/patch_system_prompt_suffix.py
COPY oh/patch_emit_system_prompt.py /tmp/patch_emit_system_prompt.py
RUN python /tmp/patch_print_mode_usage.py \
&& python /tmp/patch_openai_client.py \
&& python /tmp/patch_environment_date.py \
&& python /tmp/patch_system_prompt_suffix.py \
&& python /tmp/patch_emit_system_prompt.py \
&& rm /tmp/patch_*.py
ENTRYPOINT ["claw-anything"]