Skip to content

Commit d6a43cd

Browse files
committed
docs: add collaborator dev container context
1 parent ee49209 commit d6a43cd

12 files changed

Lines changed: 501 additions & 1 deletion

File tree

‎.devcontainer/devcontainer.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "OpenClaw source",
3+
"dockerComposeFile": ["../docker-compose.dev.yml"],
4+
"service": "openclaw-dev",
5+
"workspaceFolder": "/workspace",
6+
"remoteUser": "node",
7+
"overrideCommand": true,
8+
"shutdownAction": "stopCompose",
9+
"postCreateCommand": "scripts/docker/dev-setup.sh"
10+
}

‎.github/labeler.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,13 @@
214214
- "Dockerfile"
215215
- "Dockerfile.*"
216216
- "docker-compose.yml"
217+
- "docker-compose.dev.yml"
218+
- ".devcontainer/**"
217219
- ".dockerignore"
218220
- "deploy/fly.private.toml"
219221
- "scripts/docker/setup.sh"
222+
- "scripts/docker/dev-setup.sh"
223+
- "scripts/docker/dev-token.sh"
220224
- "scripts/docker/sandbox/Dockerfile*"
221225
- "scripts/podman/setup.sh"
222226
- "scripts/**/*docker*"

‎Dockerfile.dev‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Source-development image for collaborators.
2+
#
3+
# This image is intentionally not the production gateway image. Use the root
4+
# Dockerfile for deployable OpenClaw runtime builds and release-path validation.
5+
ARG OPENCLAW_NODE_BOOKWORM_IMAGE="node:24-bookworm@sha256:3a09aa6354567619221ef6c45a5051b671f953f0a1924d1f819ffb236e520e6b"
6+
7+
FROM ${OPENCLAW_NODE_BOOKWORM_IMAGE}
8+
9+
LABEL org.opencontainers.image.source="https://github.com/openclaw/openclaw" \
10+
org.opencontainers.image.title="OpenClaw source development" \
11+
org.opencontainers.image.description="Development container for OpenClaw source checkouts"
12+
13+
ENV COREPACK_HOME=/home/node/.local/share/corepack \
14+
PNPM_HOME=/home/node/.local/share/pnpm \
15+
PATH=/home/node/.local/share/pnpm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
16+
17+
RUN --mount=type=cache,id=openclaw-dev-apt-cache,target=/var/cache/apt,sharing=locked \
18+
--mount=type=cache,id=openclaw-dev-apt-lists,target=/var/lib/apt,sharing=locked \
19+
apt-get update && \
20+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
21+
bash \
22+
ca-certificates \
23+
curl \
24+
g++ \
25+
git \
26+
gnupg \
27+
make \
28+
openssh-client \
29+
pkg-config \
30+
procps \
31+
python3 \
32+
tini && \
33+
update-ca-certificates && \
34+
rm -rf /var/lib/apt/lists/*
35+
36+
RUN corepack enable && \
37+
install -d -m 0755 -o node -g node \
38+
"$COREPACK_HOME" \
39+
"$PNPM_HOME" \
40+
"$PNPM_HOME/store" \
41+
/home/node/.cache \
42+
/workspace \
43+
/workspace/node_modules \
44+
/workspace/ui \
45+
/workspace/ui/node_modules && \
46+
git config --system --add safe.directory /workspace
47+
48+
WORKDIR /workspace
49+
50+
COPY --chown=node:node package.json ./
51+
RUN corepack prepare "$(node -p 'require("./package.json").packageManager')" --activate && \
52+
chmod -R a+rX "$COREPACK_HOME" "$PNPM_HOME"
53+
54+
USER node
55+
56+
ENTRYPOINT ["tini", "-s", "--"]
57+
CMD ["bash"]

‎PROJECT_CONTEXT.md‎

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Project context
2+
3+
This file is the short collaborator handoff for this repository. Keep it current
4+
when the source setup, container workflow, or contributor routing changes.
5+
6+
## What this repo is
7+
8+
OpenClaw is a personal AI assistant and multi-channel gateway. The repo owns the
9+
TypeScript gateway and CLI, bundled plugins, Control UI, companion app source,
10+
public docs, Docker runtime, and the test and release harnesses around those
11+
surfaces.
12+
13+
## Current state
14+
15+
- Default branch: `main` on `openclaw/openclaw`.
16+
- Runtime: Node 24 is recommended. Node 22.16+ remains supported.
17+
- Package manager: `pnpm`, pinned by `package.json` through Corepack.
18+
- Local source loop: `pnpm install`, `pnpm openclaw setup`, then
19+
`pnpm gateway:watch`.
20+
- Production container path: root `Dockerfile` plus `docker-compose.yml`;
21+
normal gateway startup runs the `openclaw-gateway` container.
22+
- Source container path: one `openclaw-dev` service in
23+
`docker-compose.dev.yml`, backed by `Dockerfile.dev` and
24+
`.devcontainer/devcontainer.json`.
25+
- Public docs live under `docs/`. Run `pnpm docs:list` before docs work and
26+
read only the relevant pages.
27+
28+
## Collaborator entry points
29+
30+
- `README.md`: product overview, install paths, and source setup.
31+
- `CONTRIBUTING.md`: contribution rules, maintainer routing, PR proof rules.
32+
- `AGENTS.md`: repo policy for AI agents and maintainers. Read scoped
33+
`AGENTS.md` files before editing a subtree.
34+
- `docs/start/setup.md`: advanced source setup, including the dev container.
35+
- `docs/install/docker.md`: production Docker gateway setup.
36+
- `docs/plan/2026-05-17-collaborator-readiness.md`: current collaborator
37+
readiness spec, plan, and remaining decisions.
38+
39+
## Container workflows
40+
41+
For source development inside Docker:
42+
43+
```bash
44+
docker compose -f docker-compose.dev.yml build
45+
docker compose -f docker-compose.dev.yml run --rm openclaw-dev scripts/docker/dev-setup.sh
46+
docker compose -f docker-compose.dev.yml run --rm --service-ports openclaw-dev pnpm gateway:watch:raw
47+
docker compose -f docker-compose.dev.yml run --rm openclaw-dev scripts/docker/dev-token.sh
48+
```
49+
50+
For a production-shaped gateway image:
51+
52+
```bash
53+
docker build -t openclaw:local -f Dockerfile .
54+
docker compose up -d openclaw-gateway
55+
```
56+
57+
Use `Dockerfile.dev` for collaborator source work. Use the root `Dockerfile` for
58+
deployable images and release-path Docker validation.
59+
60+
The source development stack is intentionally single-container. It has no
61+
database, queue, cache, or helper service sidecars. The setup script installs
62+
dependencies and persists the local `gateway.mode`, `gateway.bind`, `gateway.port`,
63+
token auth, and Gateway/Control UI origin settings required by the
64+
container-published Gateway and Vite ports. The token helper prints the explicit
65+
local dev token only when a collaborator asks for it.
66+
67+
## Agent operating context
68+
69+
- Reply with repo-root file references, not absolute paths.
70+
- Keep core plugin-agnostic. Plugin-specific behavior belongs in the owning
71+
plugin.
72+
- Use repo wrappers for tests, formatting, and checks. In Codex worktrees, avoid
73+
broad local `pnpm test*` or `pnpm check*`; use the documented node wrappers or
74+
Testbox proof for broad gates.
75+
- Do not commit secrets. Local state belongs in `.local/`, `.env`, or
76+
`~/.openclaw/`, all outside committed source.
77+
- Product docs and UI call them "plugins"; `extensions/` is the internal source
78+
layout.
79+
80+
## Open decisions
81+
82+
- Production hosting target is not selected here. The existing Docker image is
83+
suitable for VM and container hosts, but platform-specific hardening still
84+
belongs in the chosen deploy guide.
85+
- The dev container gives collaborators a consistent Linux source environment.
86+
It does not replace release Docker proof or full cross-platform validation.

‎README.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,20 @@ pnpm ui:build
233233
pnpm gateway:watch
234234
```
235235

236+
Single-container source development is also available when you want the same
237+
Linux Node and pnpm environment across collaborators:
238+
239+
```bash
240+
docker compose -f docker-compose.dev.yml build
241+
docker compose -f docker-compose.dev.yml run --rm openclaw-dev scripts/docker/dev-setup.sh
242+
docker compose -f docker-compose.dev.yml run --rm --service-ports openclaw-dev pnpm gateway:watch:raw
243+
```
244+
245+
Use `Dockerfile.dev` for source development and the root `Dockerfile` for
246+
production-shaped gateway images. The dev setup script installs dependencies
247+
and writes the local gateway config and token auth needed for the
248+
container-published port.
249+
236250
If you need a built `dist/` from the checkout (for Node, packaging, or release validation), run:
237251

238252
```bash

‎docker-compose.dev.yml‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
services:
2+
openclaw-dev:
3+
image: openclaw:dev
4+
build:
5+
context: .
6+
dockerfile: Dockerfile.dev
7+
init: true
8+
stdin_open: true
9+
tty: true
10+
working_dir: /workspace
11+
environment:
12+
HOME: /home/node
13+
COREPACK_HOME: /home/node/.local/share/corepack
14+
PNPM_HOME: /home/node/.local/share/pnpm
15+
PLAYWRIGHT_BROWSERS_PATH: /home/node/.cache/ms-playwright
16+
PNPM_CONFIG_NETWORK_CONCURRENCY: 8
17+
TERM: xterm-256color
18+
OPENCLAW_STATE_DIR: /workspace/.local/openclaw-state
19+
OPENCLAW_CONFIG_DIR: /workspace/.local/openclaw-state
20+
OPENCLAW_CONFIG_PATH: /workspace/.local/openclaw-state/openclaw.json
21+
OPENCLAW_WORKSPACE_DIR: /workspace/.local/openclaw-workspace
22+
OPENCLAW_GATEWAY_PORT: 18789
23+
volumes:
24+
- .:/workspace:cached
25+
- openclaw-dev-pnpm-store:/home/node/.local/share/pnpm/store
26+
- openclaw-dev-cache:/home/node/.cache
27+
- openclaw-dev-node-modules:/workspace/node_modules
28+
- openclaw-dev-ui-node-modules:/workspace/ui/node_modules
29+
ports:
30+
- "18789:18789"
31+
- "5173:5173"
32+
command: ["bash"]
33+
34+
volumes:
35+
openclaw-dev-pnpm-store:
36+
openclaw-dev-cache:
37+
openclaw-dev-node-modules:
38+
openclaw-dev-ui-node-modules:

‎docs/.i18n/glossary.zh-CN.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,5 +998,9 @@
998998
{
999999
"source": "ds4 (local DeepSeek V4)",
10001000
"target": "ds4(本地 DeepSeek V4)"
1001+
},
1002+
{
1003+
"source": "Collaborator readiness and containerized development",
1004+
"target": "协作者准备和容器化开发"
10011005
}
10021006
]

‎docs/install/docker.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ title: "Docker"
88

99
Docker is **optional**. Use it only if you want a containerized gateway or to validate the Docker flow.
1010

11+
For single-container source development in a consistent Linux container, use
12+
`Dockerfile.dev` and `docker-compose.dev.yml` instead. See
13+
[Containerized source development](/start/setup#containerized-source-development).
14+
This page covers the production-shaped Gateway image and runtime Compose flow.
15+
1116
## Is Docker right for me?
1217

1318
- **Yes**: you want an isolated, throwaway gateway environment or to run OpenClaw on a host without local installs.
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: "Collaborator readiness and containerized development"
3+
summary: "Spec and plan for making the repo easier to hand to collaborators with a consistent Docker-backed source workflow"
4+
read_when:
5+
- Adding collaborators to the OpenClaw repository
6+
- Setting up source development in a container
7+
- Reviewing the current Docker and contributor handoff state
8+
---
9+
10+
## Status
11+
12+
First-pass implementation.
13+
14+
The repository already had a production-oriented Docker runtime through the root
15+
`Dockerfile` and `docker-compose.yml`. This plan adds the missing collaborator
16+
handoff layer: a concise root context file, a source-development container, and
17+
docs that explain when to use the dev container versus the production image.
18+
19+
## Goal
20+
21+
Make the repository safe and fast to hand to new collaborators by giving them
22+
clear context, the canonical operating rules, and a reproducible Linux source
23+
environment.
24+
25+
## Non-goals
26+
27+
- Do not replace the production Dockerfile with a development image.
28+
- Do not pick a production hosting provider in this pass.
29+
- Do not move secrets, auth profiles, or local OpenClaw state into the repo.
30+
- Do not change product behavior, plugin contracts, gateway protocol, or build
31+
outputs.
32+
33+
## Current state
34+
35+
- `README.md` and `CONTRIBUTING.md` explain source setup and contribution
36+
rules, but the repo did not have a short current-state handoff file for
37+
collaborators and agents.
38+
- `AGENTS.md` is the canonical repo policy file, with scoped `AGENTS.md` files
39+
under docs, scripts, source, plugins, UI, and tests.
40+
- The root `Dockerfile` is a multi-stage runtime image intended for production,
41+
release validation, and packaged gateway execution.
42+
- `docker-compose.yml` runs production-shaped `openclaw-gateway` and
43+
`openclaw-cli` services against the built image.
44+
- Source development still needed a lightweight container entry point that
45+
mounts the repo and runs `pnpm` commands in a consistent Node Linux
46+
environment without adding service sidecars.
47+
- Fresh source containers needed an explicit local gateway config stamp before
48+
the watcher could start cleanly on a host-published port.
49+
50+
## Spec
51+
52+
The collaborator-ready repo should provide three clear paths:
53+
54+
1. Local source development for contributors who already have Node and pnpm.
55+
2. Source development inside Docker for collaborators who want the same Linux
56+
toolchain and dependency layout.
57+
3. Production-shaped Docker runtime for deployment and release-path validation.
58+
59+
The source-development container must:
60+
61+
- Use Node 24, matching the recommended source runtime.
62+
- Use the repo-pinned `packageManager` through Corepack.
63+
- Mount the checkout at `/workspace`.
64+
- Keep container dependency caches in Docker volumes.
65+
- Keep local OpenClaw state under the repo ignored `.local/` directory by
66+
default.
67+
- Define exactly one source-development service and no sidecar containers.
68+
- Expose only the Gateway and Vite UI ports used by the normal dev loop.
69+
- Persist `gateway.mode=local`, `gateway.bind=lan`, `gateway.port=18789`,
70+
token auth, and matching Gateway and Vite Control UI origins during first-run
71+
setup.
72+
- Stay separate from the production Dockerfile so deploy images remain minimal.
73+
74+
The documentation must:
75+
76+
- Point collaborators first to `PROJECT_CONTEXT.md`, `README.md`,
77+
`CONTRIBUTING.md`, and `AGENTS.md`.
78+
- Explain when to use `Dockerfile.dev` versus the root `Dockerfile`.
79+
- Keep Docker install docs focused on the deployable gateway path while linking
80+
source development back to setup docs.
81+
82+
## Implementation plan
83+
84+
1. Add `PROJECT_CONTEXT.md` at the repo root with the current state, entry
85+
points, container paths, agent rules, and open decisions.
86+
2. Add `Dockerfile.dev` for a source-development image based on Node 24 with
87+
Corepack, pnpm, Git, Python, build tools, and `tini`.
88+
3. Add `docker-compose.dev.yml` with a single `openclaw-dev` service that
89+
mounts the repo, persists pnpm and Node dependency volumes, maps Gateway
90+
ports, and defaults to a shell.
91+
4. Add `scripts/docker/dev-setup.sh` to install dependencies, generate or reuse
92+
local token auth, and persist the local gateway config required by
93+
containerized source development.
94+
5. Add `scripts/docker/dev-token.sh` to print the local dev token explicitly
95+
without making first-run setup echo secrets by default.
96+
6. Add `.devcontainer/devcontainer.json` so VS Code and compatible tools can
97+
open the same Compose-backed source container.
98+
7. Update `README.md`, `docs/start/setup.md`, and `docs/install/docker.md` to
99+
describe the source-development container and distinguish it from the
100+
production Docker path.
101+
8. Update `.github/labeler.yml` so Docker-related dev container changes route
102+
to the Docker label.
103+
9. Verify docs formatting and the container smoke path before publishing the
104+
branch.
105+
106+
## Remaining decisions
107+
108+
- Choose the actual production host and deployment model.
109+
- Decide whether collaborators should use GitHub Codespaces in addition to the
110+
local dev container.
111+
- Decide whether to publish a prebuilt dev image or keep building it locally
112+
from `Dockerfile.dev`.
113+
- Decide which broad Docker or release-path Testbox lane should become the
114+
final gate before merging this branch.

0 commit comments

Comments
 (0)