Skip to content

Commit 38fdb04

Browse files
namelessmanhaobibohaobibo
authored
feat: add OpenClaw Docker support (#55)
* feat: add OpenClaw Docker support with configuration and bootstrap script * refactor: update Dockerfile and bootstrap script for OpenClaw installation * update openclaw install * debug openclaw install * optimize claw build * opt openclaw build * update claw * debug build * debug paths * debug * debug * debug claw pkgs * update for pnpm install scripts * Delete .codex --------- Co-authored-by: haobibo <haobibo@noreploy.github.com> Co-authored-by: Bibo Hao <haobibo@users.noreply.github.com>
1 parent 6dadcf4 commit 38fdb04

10 files changed

Lines changed: 527 additions & 41 deletions

File tree

.github/workflows/build-docker.yml

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ name: build-docker-images
22

33
on:
44
push:
5-
branches: [ "main" ]
6-
paths-ignore: [ "*.md" ]
5+
branches: ["main"]
6+
paths-ignore: ["*.md"]
77

88
pull_request:
9-
branches: [ "main" ]
10-
paths-ignore: [ "*.md" ]
9+
branches: ["main"]
10+
paths-ignore: ["*.md"]
1111

12-
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
1313

1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1616
cancel-in-progress: true
1717

1818
env:
19-
BUILDKIT_PROGRESS: "plain" # Full logs for CI build.
19+
BUILDKIT_PROGRESS: "plain" # Full logs for CI build.
2020
REGISTRY_SRC: ${{ vars.REGISTRY_SRC || 'docker.io' }} # For BASE_NAMESPACE of images: where to pull base images from, docker.io or other source registry URL.
2121
REGISTRY_DST: ${{ vars.REGISTRY_DST || 'docker.io' }} # For tags of built images: where to push images to, docker.io or other destination registry URL.
2222
# DOCKER_REGISTRY_USERNAME and DOCKER_REGISTRY_PASSWORD is required for docker image push, they should be set in CI secrets.
@@ -30,7 +30,7 @@ env:
3030
jobs:
3131
## Clash
3232
docker_clash:
33-
name: 'app-clash'
33+
name: "app-clash"
3434
runs-on: ubuntu-latest
3535
steps:
3636
- uses: actions/checkout@v5
@@ -39,7 +39,7 @@ jobs:
3939
4040
## Casdoor
4141
docker_casdoor:
42-
name: 'casdoor'
42+
name: "casdoor"
4343
runs-on: ubuntu-latest
4444
steps:
4545
- uses: actions/checkout@v5
@@ -48,7 +48,7 @@ jobs:
4848
4949
## Keycloak
5050
docker_keycloak:
51-
name: 'keycloak'
51+
name: "keycloak"
5252
runs-on: ubuntu-latest
5353
steps:
5454
- uses: actions/checkout@v5
@@ -57,7 +57,7 @@ jobs:
5757
5858
## DevHub
5959
job-dev-hub:
60-
name: 'dev-hub'
60+
name: "dev-hub"
6161
runs-on: ubuntu-latest
6262
steps:
6363
- uses: actions/checkout@v5
@@ -70,7 +70,7 @@ jobs:
7070
7171
## OpenResty as gateway
7272
job-openresty:
73-
name: 'openresty'
73+
name: "openresty"
7474
runs-on: ubuntu-latest
7575
steps:
7676
- uses: actions/checkout@v5
@@ -79,7 +79,7 @@ jobs:
7979
8080
## SearchNGX for searching
8181
job-searxng:
82-
name: 'searxng'
82+
name: "searxng"
8383
runs-on: ubuntu-latest
8484
steps:
8585
- uses: actions/checkout@v5
@@ -88,7 +88,7 @@ jobs:
8888
8989
## StoreBox
9090
job-storebox:
91-
name: 'storebox'
91+
name: "storebox"
9292
runs-on: ubuntu-latest
9393
steps:
9494
- uses: actions/checkout@v5
@@ -98,7 +98,7 @@ jobs:
9898
9999
## lognet for log management
100100
job-logent:
101-
name: 'logent'
101+
name: "logent"
102102
runs-on: ubuntu-latest
103103
steps:
104104
- uses: actions/checkout@v5
@@ -108,18 +108,27 @@ jobs:
108108
109109
## nocobase for low-code development platform
110110
job-nocobase:
111-
name: 'nocobase'
111+
name: "nocobase"
112112
runs-on: ubuntu-latest
113113
steps:
114114
- uses: actions/checkout@v5
115115
- run: |
116116
source ./tool.sh
117117
build_image nocobase latest docker_nocobase/nocobase.Dockerfile && push_image nocobase
118118
119+
## OpenClaw
120+
job-openclaw:
121+
name: "openclaw"
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: actions/checkout@v5
125+
- run: |
126+
source ./tool.sh
127+
build_image openclaw latest docker_openclaw/openclaw.Dockerfile && push_image openclaw
119128
120129
## DevBox - base
121130
job-base-dev:
122-
name: 'developer,base-dev'
131+
name: "developer,base-dev"
123132
runs-on: ubuntu-latest
124133
steps:
125134
- uses: actions/checkout@v5
@@ -133,7 +142,7 @@ jobs:
133142
134143
## DevBox - data science stack
135144
job-data-science-dev:
136-
name: 'data-science-dev'
145+
name: "data-science-dev"
137146
runs-on: ubuntu-latest
138147
steps:
139148
- uses: actions/checkout@v5
@@ -148,7 +157,7 @@ jobs:
148157
149158
## DevBox - full stack
150159
job-full-stack-dev:
151-
name: 'full-stack-dev'
160+
name: "full-stack-dev"
152161
runs-on: ubuntu-latest
153162
steps:
154163
- uses: actions/checkout@v5
@@ -163,7 +172,7 @@ jobs:
163172
164173
## DevBox - cuda
165174
job-cuda-dev:
166-
name: 'full-cuda,cuda-dev'
175+
name: "full-cuda,cuda-dev"
167176
runs-on: ubuntu-latest
168177
steps:
169178
- uses: actions/checkout@v5
@@ -175,10 +184,25 @@ jobs:
175184
--build-arg "ARG_PROFILE_VSCODE=base"
176185
alias_image cuda-dev latest full-cuda latest && push_image dev
177186
178-
179187
## Sync all images in this build (listed by "names") to mirror registry.
180188
sync_images:
181-
needs: ["job-cuda-dev", "job-data-science-dev", "job-full-stack-dev", "job-base-dev", "job-nocobase", "job-logent", "job-storebox", "job-searxng", "job-openresty", "job-dev-hub", "docker_keycloak", "docker_casdoor", "docker_clash"]
189+
needs:
190+
[
191+
"job-cuda-dev",
192+
"job-data-science-dev",
193+
"job-full-stack-dev",
194+
"job-base-dev",
195+
"job-nocobase",
196+
"job-openclaw",
197+
"job-logent",
198+
"job-storebox",
199+
"job-searxng",
200+
"job-openresty",
201+
"job-dev-hub",
202+
"docker_keycloak",
203+
"docker_casdoor",
204+
"docker_clash",
205+
]
182206
runs-on: ubuntu-latest
183207
steps:
184208
- uses: actions/checkout@v5

docker_devbox/dev.Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,30 @@ COPY work /opt/utils/
2121

2222
RUN set -eux && source /opt/utils/script-utils.sh \
2323
&& chmod +x /opt/utils/*.sh \
24-
# ----------------------------- Setup Jupyter: Basic Configurations and Extensions
24+
## ----------------------------- Setup Jupyter: Basic Configurations and Extensions
2525
&& mkdir -pv /opt/conda/etc/jupyter/ \
2626
&& mv /opt/utils/etc_jupyter/* /opt/conda/etc/jupyter/ && rm -rf /opt/utils/etc_jupyter \
2727
&& mv /opt/utils/start-*.sh /usr/local/bin/ && chmod +x /usr/local/bin/start-*.sh \
2828
&& ln -sf /usr/local/bin/start-jupyterlab.sh /usr/local/bin/start-notebook.sh \
2929
&& source /opt/utils/script-devbox-jupyter.sh \
3030
&& for profile in $(echo $ARG_PROFILE_JUPYTER | tr "," "\n") ; do ( setup_jupyter_${profile} || true ) ; done \
31-
# ----------------------------- If installing coder-server # https://github.com/cdr/code-server/releases
31+
## ----------------------------- If installing coder-server # https://github.com/cdr/code-server/releases
3232
&& source /opt/utils/script-devbox-vscode.sh \
3333
&& for profile in $(echo $ARG_PROFILE_VSCODE | tr "," "\n") ; do ( setup_vscode_${profile} || true ) ; done \
34-
# ----------------------------- If not keeping NodeJS, remove NoedJS to reduce image size
34+
## ----------------------------- If not keeping NodeJS, remove NoedJS to reduce image size
3535
&& if [ ${ARG_KEEP_NODEJS} = "false" ] ; then \
3636
echo "Removing Node/NPM..." && rm -rf /usr/bin/node /usr/bin/npm /usr/bin/npx /opt/node ; \
3737
else \
3838
echo "Keep NodeJS as ARG_KEEP_NODEJS defiend as: ${ARG_KEEP_NODEJS}" ; \
3939
fi \
40-
# ----------------------------- If installing R IDEs: R_rstudio and R_rshiny
40+
## ----------------------------- If installing R IDEs: R_rstudio and R_rshiny
4141
&& source /opt/utils/script-devbox-rstudio.sh \
4242
&& for profile in $(echo $ARG_PROFILE_R | tr "," "\n") ; do ( setup_R_${profile} ) ; done \
43-
# ----------------------------- Install supervisord
43+
## ----------------------------- Install supervisord
4444
&& source /opt/utils/script-setup-sys.sh && setup_supervisord \
45-
# ----------------------------- Install caddy
45+
## ----------------------------- Install caddy
4646
&& source /opt/utils/script-setup-net.sh && setup_caddy \
47-
# Clean up and display components version information...
47+
## Clean up and display components version information...
4848
&& list_installed_packages && install__clean
4949

5050
ENTRYPOINT ["tini", "-g", "--"]

docker_devbox/hub.Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ COPY work /opt/utils/
1515

1616
RUN set -eux \
1717
&& chmod +x /opt/utils/*.sh && rm -rf /opt/utils/etc_jupyter \
18-
# Setup JupyterHub
18+
## Setup JupyterHub
1919
&& source /opt/utils/script-devbox-jupyter.sh \
2020
&& for profile in $(echo $ARG_PROFILE_JUPYTER | tr "," "\n") ; do ( setup_jupyter_${profile} ) ; done \
21-
# If not keeping NodeJS, remove NoedJS to reduce image size, and install Traefik instead
21+
## If not keeping NodeJS, remove NoedJS to reduce image size, and install Traefik instead
2222
&& if [ ${ARG_KEEP_NODEJS} = "false" ] ; then \
2323
echo "Removing Node/NPM..." && rm -rf /usr/bin/node /usr/bin/npm /usr/bin/npx /opt/node ; \
2424
echo "Installing Traefik to server as proxy:" && source /opt/utils/script-setup-net.sh && setup_traefik ; \
2525
else \
2626
echo "Keep NodeJS as ARG_KEEP_NODEJS defiend as: ${ARG_KEEP_NODEJS}" ; \
2727
fi \
28-
# network-tools https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/main/images/network-tools/Dockerfile
28+
## network-tools https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/main/images/network-tools/Dockerfile
2929
&& apt-get update && apt-get install -y --no-install-recommends \
3030
iptables dnsutils libcurl4 libpq5 sqlite3 \
3131
&& curl -fsSL -o /usr/local/bin/start-configurable-http-proxy.sh https://raw.githubusercontent.com/jupyterhub/configurable-http-proxy/refs/heads/main/chp-docker-entrypoint \
3232
&& mv /opt/utils/start-*.sh /usr/local/bin/ \
3333
&& chmod +x /usr/local/bin/start-*.sh \
34-
# Clean up and display components version information...
34+
## Clean up and display components version information...
3535
&& source /opt/utils/script-utils.sh && install__clean && list_installed_packages
3636

3737
ENTRYPOINT ["tini", "-g", "--"]

docker_nocobase/nocobase.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RUN set -eux \
2525
&& mv /opt/utils/docker-entrypoint.sh /opt/nocobase/ \
2626
&& chmod +x /opt/nocobase/*.sh \
2727
&& ls -alh \
28-
# Clean up and display components version information...
28+
## Clean up and display components version information...
2929
&& find ./node_modules -type f \( -name "README.md" -o -name "License" \) -delete 2>/dev/null \
3030
&& find ./node_modules -type d \( -name "test" -o -name "tests" -o -name "__tests__" -o -name "docs" -o -name "doc" \) -exec rm -rf {} + 2>/dev/null \
3131
&& list_installed_packages && install__clean
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "svc-openclaw"
2+
3+
services:
4+
openclaw-gateway:
5+
container_name: svc-openclaw-gateway
6+
hostname: svc-openclaw-gateway
7+
image: "quay.io/labnow0dev/openclaw:latest"
8+
pull_policy: if_not_present
9+
restart: unless-stopped
10+
environment:
11+
- TZ=Asia/Shanghai
12+
- PROFILE_LOCALIZE=aliyun-pub
13+
volumes:
14+
- /data/openclaw:/opt/openclaw/data
15+
ports:
16+
- "${OPENCLAW_GATEWAY_PORT:-18789}:18789"
17+
- "${OPENCLAW_BRIDGE_PORT:-18790}:18790"
18+
init: true
19+
20+
openclaw-cli:
21+
container_name: svc-openclaw-cli
22+
hostname: svc-openclaw-cli
23+
image: "quay.io/labnow0dev/openclaw:latest"
24+
pull_policy: if_not_present
25+
restart: "no"
26+
environment:
27+
- TZ=Asia/Shanghai
28+
- PROFILE_LOCALIZE=aliyun-pub
29+
- BROWSER=echo
30+
volumes:
31+
- /data/openclaw:/opt/openclaw/data
32+
init: true
33+
stdin_open: true
34+
tty: true
35+
entrypoint: ["node", "openclaw.mjs"]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Distributed under the terms of the Modified BSD License.
2+
3+
ARG BASE_NAMESPACE
4+
ARG BASE_IMG="node"
5+
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG}
6+
7+
LABEL maintainer="postmaster@labnow.ai"
8+
ENV NODE_ENV=production
9+
ENV PNPM_HOME=/opt/node/pnpm
10+
ENV PNPM_STORE_DIR=/opt/node/pnpm-store
11+
ENV PNPM_NODE_LINKER=hoisted
12+
ENV PATH="${PNPM_HOME}:${PATH}"
13+
14+
COPY work /opt/openclaw/
15+
16+
RUN set -eux && source /opt/utils/script-setup.sh \
17+
&& chmod +x /opt/openclaw/start-openclaw.sh && ln -sf /opt/openclaw/start-openclaw.sh /usr/local/bin/ \
18+
&& mkdir -pv /opt/openclaw/data \
19+
&& ln -sfn /opt/openclaw/data /opt/openclaw/.openclaw \
20+
## curl -fsSL https://openclaw.ai/install.sh | NO_PROMPT=1 bash -s -- --no-onboard --install-method npm \
21+
&& export SHARP_IGNORE_GLOBAL_LIBVIPS=1 \
22+
&& setup_node_pnpm 10 \
23+
&& pnpm config set enable-pre-post-scripts true \
24+
&& pnpm install -g openclaw@latest --ignore-scripts=false \
25+
&& openclaw --version \
26+
## Clean up and display components version information...
27+
&& list_installed_packages && install__clean
28+
29+
ENV HOME=/opt/openclaw/
30+
ENV XDG_CONFIG_HOME=/opt/openclaw/data
31+
WORKDIR /opt/openclaw
32+
VOLUME ["/opt/openclaw/data"]
33+
EXPOSE 18789 18790
34+
CMD ["sh", "start-openclaw.sh", "gateway", "--allow-unconfigured", "--bind", "${OPENCLAW_GATEWAY_BIND:-lan}", "--port", "${OPENCLAW_GATEWAY_PORT:-18789}"]

0 commit comments

Comments
 (0)