Skip to content

Commit c933577

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents b394ca5 + 78c3208 commit c933577

File tree

4 files changed

+64
-3
lines changed

4 files changed

+64
-3
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ KIMI_BASE_URL=
195195
# Example: OPENCLAW_DOCKER_APT_PACKAGES=ffmpeg build-essential
196196
# OPENCLAW_DOCKER_APT_PACKAGES=
197197

198+
# ── Custom init script (optional) ─────────────────────────────────────────────
199+
# Script that runs on every container start before openclaw starts.
200+
# Must be executable (chmod +x) and idempotent. Useful for extra runtime setup.
201+
# WARNING: Runs with container privileges. Review scripts from untrusted sources.
202+
# OPENCLAW_DOCKER_INIT_SCRIPT=/data/init.d/init.sh
203+
198204
# ── Port ─────────────────────────────────────────────────────────────────────
199205
PORT=8080
200206

Dockerfile.base

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,33 @@ RUN apt-get update \
4343
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
4444
ca-certificates \
4545
curl \
46+
git \
47+
build-essential \
48+
file \
49+
procps \
4650
&& rm -rf /var/lib/apt/lists/*
4751

52+
# Install Linuxbrew (installer refuses to run as root, so use a temp user)
53+
RUN useradd -m -s /bin/bash linuxbrew \
54+
&& mkdir -p /home/linuxbrew/.linuxbrew \
55+
&& chown -R linuxbrew:linuxbrew /home/linuxbrew
56+
USER linuxbrew
57+
RUN NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
58+
USER root
59+
RUN chmod -R a+rx /home/linuxbrew/.linuxbrew
60+
ENV HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" \
61+
HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar" \
62+
HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew" \
63+
PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}"
64+
65+
# Install Go (used by many skills)
66+
RUN curl -fsSL https://go.dev/dl/go1.24.1.linux-$(dpkg --print-architecture).tar.gz | tar -C /usr/local -xz
67+
ENV PATH="/usr/local/go/bin:${PATH}"
68+
69+
# Install uv (fast Python package manager, used by Python-based skills)
70+
RUN curl -fsSL https://astral.sh/uv/install.sh | sh
71+
ENV PATH="/root/.local/bin:${PATH}"
72+
4873
# Install under /opt/openclaw/app so that ../../ from dist/ lands at /opt/openclaw
4974
# which is where we place the symlinks. This avoids polluting / with project files.
5075
COPY --from=openclaw-build /openclaw /opt/openclaw/app

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,22 @@ docker compose up -d
3939
┌─────────────────────────────────────────────┐
4040
│ Docker container (coollabsio/openclaw) │
4141
│ │
42+
│ Baked in: Linuxbrew, Go, uv, build-essential│
43+
│ Persistent volume: /data │
44+
│ ├── .openclaw/ (state & config) │
45+
│ └── workspace/ (user projects) │
46+
│ │
4247
│ ┌──────────┐ :8080 ┌────────────────┐ │
4348
│ │ nginx │ ──────→ │ openclaw │ │
4449
│ │ (basic │ proxy │ gateway │ │
4550
│ │ auth) │ :18789 │ :18789 │ │
4651
│ └──────────┘ └────────────────┘ │
4752
│ │
4853
│ entrypoint.sh │
49-
│ 1. configure.js (env vars → json) │
50-
│ 2. nginx (background) │
51-
│ 3. exec openclaw gateway │
54+
│ 1. run custom init script (optional) │
55+
│ 2. configure.js (env vars → json) │
56+
│ 3. nginx (background) │
57+
│ 4. exec openclaw gateway │
5258
└─────────────────────────────────────────────┘
5359
```
5460

@@ -312,6 +318,23 @@ If a channel env var is removed, that channel is cleaned from config on next sta
312318
|---|---|
313319
| `OPENCLAW_DOCKER_APT_PACKAGES` | Space-separated list of apt packages to install at container startup (e.g. `ffmpeg build-essential`). Packages are installed before openclaw starts. Reinstalled on each container restart. |
314320

321+
### Linuxbrew (baked into image)
322+
323+
The base image includes common skill dependencies baked in:
324+
325+
- **Linuxbrew**`/home/linuxbrew/.linuxbrew` — skills that need `brew` work out of the box
326+
- **Go**`/usr/local/go` — for Go-based skills and tools
327+
- **uv** — fast Python package manager for Python-based skills
328+
- **build-essential**, **git**, **curl** — common build dependencies
329+
330+
Note: packages installed at runtime (e.g. via `brew install`) are part of the container filesystem and do **not** persist across container rebuilds. To permanently add packages, customize `Dockerfile.base` or use `OPENCLAW_DOCKER_APT_PACKAGES` for apt-available equivalents.
331+
332+
### Custom init script (optional)
333+
334+
| Variable | Default | Description |
335+
|---|---|---|
336+
| `OPENCLAW_DOCKER_INIT_SCRIPT` | *(none)* | Script that runs on every container start before openclaw starts. Must be executable and idempotent. |
337+
315338
### Port
316339

317340
| Variable | Default | Description |

scripts/entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ export OPENCLAW_WORKSPACE_DIR="$WORKSPACE_DIR"
6161
# (symlinks are detected as separate paths).
6262
export HOME="${STATE_DIR%/.openclaw}"
6363

64+
# ── Run custom init script (if provided) ─────────────────────────────────────
65+
INIT_SCRIPT="${OPENCLAW_DOCKER_INIT_SCRIPT:-}"
66+
if [ -n "$INIT_SCRIPT" ] && [ -f "$INIT_SCRIPT" ] && [ -x "$INIT_SCRIPT" ]; then
67+
echo "[entrypoint] running init script: $INIT_SCRIPT"
68+
"$INIT_SCRIPT" || echo "[entrypoint] WARNING: init script exited with code $?"
69+
fi
70+
6471
# ── Configure openclaw from env vars ─────────────────────────────────────────
6572
echo "[entrypoint] running configure..."
6673
node /app/scripts/configure.js

0 commit comments

Comments
 (0)