Fix public Docker task copies

This commit is contained in:
scoootscooob 2026-04-27 22:57:10 -07:00
parent 595cdc910c
commit 4b7a9ee31c
4 changed files with 24 additions and 12 deletions

View File

@ -23,7 +23,8 @@ WORKDIR /home/node/app
COPY --chown=node:node pyproject.toml README.md ./
COPY --chown=node:node clawbench/ clawbench/
COPY --chown=node:node tasks/ tasks/
COPY --chown=node:node tasks-public/ tasks-public/
COPY --chown=node:node tasks-domain/ tasks-domain/
COPY --chown=node:node baselines/ baselines/
COPY --chown=node:node app.py .

View File

@ -27,7 +27,8 @@ WORKDIR /home/node/app
COPY --chown=node:node pyproject.toml README.md ./
COPY --chown=node:node clawbench/ clawbench/
COPY --chown=node:node tasks/ tasks/
COPY --chown=node:node tasks-public/ tasks-public/
COPY --chown=node:node tasks-domain/ tasks-domain/
COPY --chown=node:node baselines/ baselines/
COPY --chown=node:node app.py .

View File

@ -15,13 +15,11 @@ from clawbench.schemas import TaskDefinition
def _resolve_tasks_dir() -> Path:
"""Resolve the tasks directory at import time.
When ClawBench is run from a source checkout, `tasks/` is a sibling of
the `clawbench/` package directory. When the package is pip-installed
(e.g. inside the HF Space Docker image), that sibling relationship no
longer holds pip copies only `clawbench/` into site-packages, and
`tasks/` lives at the Docker WORKDIR instead. This resolver tries a
series of candidates in order and falls back to the sibling-of-source
path so source runs stay unaffected.
When ClawBench is run from a private source checkout, `tasks/` is a
sibling of the `clawbench/` package directory. Public checkouts and the
HF Space Docker image ship `tasks-public/` instead. This resolver tries a
series of candidates in order and falls back to the sibling-of-source path
so private source runs stay unaffected.
"""
# 1. Explicit override via environment variable.
env_dir = os.environ.get("CLAWBENCH_TASKS_DIR", "").strip()
@ -36,13 +34,12 @@ def _resolve_tasks_dir() -> Path:
return sibling
# 3. Current working directory (works when the user runs clawbench from
# a repo root that has tasks/ in it — matches the Dockerfile WORKDIR
# layout `/home/node/app/tasks`).
# a private repo root that has tasks/ in it).
cwd_dir = Path.cwd() / "tasks"
if (cwd_dir / "tier1").is_dir():
return cwd_dir
# 4. Known Docker/HF Space layout.
# 4. Known private Docker/HF Space layout.
for container_candidate in (
Path("/home/node/app/tasks"),
Path("/home/user/app/tasks"),

13
tests/test_dockerfiles.py Normal file
View File

@ -0,0 +1,13 @@
from pathlib import Path
def test_public_dockerfiles_copy_public_task_sets():
repo_root = Path(__file__).resolve().parent.parent
for dockerfile_name in ("Dockerfile", "Dockerfile.main"):
dockerfile = repo_root / dockerfile_name
contents = dockerfile.read_text(encoding="utf-8")
assert "COPY --chown=node:node tasks-public/ tasks-public/" in contents
assert "COPY --chown=node:node tasks-domain/ tasks-domain/" in contents
assert "COPY --chown=node:node tasks/ tasks/" not in contents