Skip to content

Commit 4a83a4f

Browse files
feat: update openclaw Dockerfile
1 parent 13ed6ab commit 4a83a4f

File tree

10 files changed

+68
-20
lines changed

10 files changed

+68
-20
lines changed

.github/workflows/node-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v5
2020

2121
- name: Set up QEMU
2222
uses: docker/setup-qemu-action@v3
@@ -31,7 +31,7 @@ jobs:
3131
password: ${{ secrets.DOCKERHUB_PASSWORD }}
3232

3333
- name: Build Node Image and Push
34-
uses: docker/build-push-action@v5
34+
uses: docker/build-push-action@v6
3535
with:
3636
context: node
3737
file: node/Dockerfile

.github/workflows/openclaw-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- name: Checkout
31-
uses: actions/checkout@v4
31+
uses: actions/checkout@v5
3232

3333
- name: Set up QEMU
3434
uses: docker/setup-qemu-action@v3
@@ -50,7 +50,7 @@ jobs:
5050
| tar -xz -C _src/openclaw --strip-components=1
5151
5252
- name: Build OpenClaw Image and Push
53-
uses: docker/build-push-action@v5
53+
uses: docker/build-push-action@v6
5454
with:
5555
context: _src/openclaw
5656
file: openclaw/Dockerfile
@@ -66,7 +66,7 @@ jobs:
6666

6767
- name: Push Latest Tag
6868
if: ${{ github.event_name == 'push' || github.event.inputs.pushLatest == 'true' }}
69-
uses: docker/build-push-action@v5
69+
uses: docker/build-push-action@v6
7070
with:
7171
context: _src/openclaw
7272
file: openclaw/Dockerfile

.github/workflows/php5-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v5
1717

1818
- name: Set up QEMU
1919
uses: docker/setup-qemu-action@v3
@@ -28,7 +28,7 @@ jobs:
2828
password: ${{ secrets.DOCKERHUB_PASSWORD }}
2929

3030
- name: Build PHP-5.6 and Push
31-
uses: docker/build-push-action@v5
31+
uses: docker/build-push-action@v6
3232
with:
3333
context: php/5.6.40
3434
file: php/5.6.40/Dockerfile
@@ -41,4 +41,4 @@ jobs:
4141

4242

4343

44-
44+

.github/workflows/php7-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v4
20+
uses: actions/checkout@v5
2121

2222
- name: Set up QEMU
2323
uses: docker/setup-qemu-action@v3
@@ -32,7 +32,7 @@ jobs:
3232
password: ${{ secrets.DOCKERHUB_PASSWORD }}
3333

3434
- name: Build PHP-7.4 and Push
35-
uses: docker/build-push-action@v5
35+
uses: docker/build-push-action@v6
3636
with:
3737
context: php/7
3838
file: php/7/Dockerfile
@@ -46,7 +46,7 @@ jobs:
4646
cache-to: type=gha,mode=max
4747

4848
- name: Build PHP-7.3 and Push
49-
uses: docker/build-push-action@v5
49+
uses: docker/build-push-action@v6
5050
with:
5151
context: php/7
5252
file: php/7/Dockerfile

.github/workflows/php7.x-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v5
2424

2525
- name: Set up QEMU
2626
uses: docker/setup-qemu-action@v3
@@ -35,7 +35,7 @@ jobs:
3535
password: ${{ secrets.DOCKERHUB_PASSWORD }}
3636

3737
- name: Build PHP-7.x and Push
38-
uses: docker/build-push-action@v5
38+
uses: docker/build-push-action@v6
3939
with:
4040
context: php/${{ github.event.inputs.php_dir }}
4141
file: php/${{ github.event.inputs.php_dir }}/Dockerfile
@@ -46,4 +46,4 @@ jobs:
4646
tags: |
4747
1panel/php:${{ github.event.inputs.php_version }}-fpm
4848
cache-from: type=gha
49-
cache-to: type=gha,mode=max
49+
cache-to: type=gha,mode=max

.github/workflows/php8-release.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@v5
1616

1717
- name: Set up QEMU
1818
uses: docker/setup-qemu-action@v3
@@ -26,7 +26,7 @@ jobs:
2626
username: ${{ secrets.DOCKERHUB_USERNAME }}
2727
password: ${{ secrets.DOCKERHUB_PASSWORD }}
2828
- name: Build PHP-FPM Image and Push
29-
uses: docker/build-push-action@v5
29+
uses: docker/build-push-action@v6
3030
with:
3131
context: php/8
3232
file: php/8/Dockerfile
@@ -38,4 +38,3 @@ jobs:
3838
1panel/php:${{ github.event.inputs.phpVersion }}-fpm
3939
cache-from: type=gha
4040
cache-to: type=gha,mode=max
41-

.github/workflows/sync-to-cnb.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
sync:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v4
10+
- uses: actions/checkout@v5
1111
with:
1212
fetch-depth: 0
1313

@@ -21,4 +21,4 @@ jobs:
2121
-e PLUGIN_USERNAME="cnb" \
2222
-e PLUGIN_PASSWORD=${{ secrets.CNB_PASSWORD }} \
2323
-e PLUGIN_FORCE=true \
24-
tencentcom/git-sync
24+
tencentcom/git-sync

openclaw/Caddyfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
admin off
3+
auto_https disable_redirects
4+
storage file_system {
5+
root /data/caddy
6+
}
7+
}
8+
9+
https://{$CADDY_SITE_ADDRESS}:{$CADDY_HTTPS_PORT} {
10+
tls internal
11+
reverse_proxy 127.0.0.1:18789
12+
}

openclaw/Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# Slim (bookworm-slim): docker build --build-arg OPENCLAW_VARIANT=slim .
1515
ARG OPENCLAW_EXTENSIONS=""
1616
ARG OPENCLAW_VARIANT=default
17+
ARG OPENCLAW_CADDY_IMAGE="caddy:2"
1718
ARG OPENCLAW_NODE_BOOKWORM_IMAGE="node:24-bookworm@sha256:3a09aa6354567619221ef6c45a5051b671f953f0a1924d1f819ffb236e520e6b"
1819
ARG OPENCLAW_NODE_BOOKWORM_DIGEST="sha256:3a09aa6354567619221ef6c45a5051b671f953f0a1924d1f819ffb236e520e6b"
1920
ARG OPENCLAW_NODE_BOOKWORM_SLIM_IMAGE="node:24-bookworm-slim@sha256:e8e2e91b1378f83c5b2dd15f0247f34110e2fe895f6ca7719dbb780f929368eb"
@@ -36,6 +37,8 @@ RUN mkdir -p /out && \
3637
fi; \
3738
done
3839

40+
FROM ${OPENCLAW_CADDY_IMAGE} AS caddy-binary
41+
3942
FROM ${OPENCLAW_NODE_BOOKWORM_IMAGE} AS build
4043

4144
# Install Bun (required for build scripts). Retry the whole bootstrap flow to
@@ -142,6 +145,9 @@ COPY --from=runtime-assets --chown=node:node /app/openclaw.mjs .
142145
COPY --from=runtime-assets --chown=node:node /app/extensions ./extensions
143146
COPY --from=runtime-assets --chown=node:node /app/skills ./skills
144147
COPY --from=runtime-assets --chown=node:node /app/docs ./docs
148+
COPY --from=caddy-binary /usr/bin/caddy /usr/bin/caddy
149+
COPY openclaw/Caddyfile /etc/caddy/Caddyfile
150+
COPY openclaw/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
145151

146152
# Keep pnpm available in the runtime image for container-local workflows.
147153
# Use a shared Corepack home so the non-root `node` user does not need a
@@ -225,9 +231,13 @@ RUN printf '%s\n' \
225231
'set -e' \
226232
'exec node /app/openclaw.mjs "$@"' \
227233
> /usr/local/bin/openclaw && \
228-
chmod 755 /usr/local/bin/openclaw /app/openclaw.mjs
234+
install -d -o node -g node /data /config /etc/caddy /tmp/caddy && \
235+
chmod 755 /usr/local/bin/openclaw /usr/local/bin/docker-entrypoint.sh /usr/bin/caddy /app/openclaw.mjs && \
236+
chown -R node:node /data /config /etc/caddy /tmp/caddy
229237
# -----------------------------
230238

239+
ENV CADDY_HTTPS_PORT=8443
240+
ENV CADDY_SITE_ADDRESS=127.0.0.1
231241
ENV NODE_ENV=production
232242

233243
# Security hardening: Run as non-root user
@@ -250,4 +260,6 @@ USER node
250260
HEALTHCHECK --interval=3m --timeout=10s --start-period=15s --retries=3 \
251261
CMD node -e "fetch('http://127.0.0.1:18789/healthz').then((r)=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
252262

263+
EXPOSE 8443
264+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
253265
CMD ["openclaw", "gateway", "--allow-unconfigured"]

openclaw/docker-entrypoint.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
mkdir -p /tmp/caddy /data/caddy /config/caddy
5+
6+
"$@" &
7+
openclaw_pid=$!
8+
9+
/usr/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile &
10+
caddy_pid=$!
11+
12+
term_handler() {
13+
kill "$openclaw_pid" "$caddy_pid" 2>/dev/null || true
14+
}
15+
16+
trap term_handler INT TERM HUP
17+
18+
while kill -0 "$openclaw_pid" 2>/dev/null && kill -0 "$caddy_pid" 2>/dev/null; do
19+
sleep 1
20+
done
21+
22+
term_handler
23+
wait "$openclaw_pid" || true
24+
wait "$caddy_pid" || true
25+
exit 1

0 commit comments

Comments
 (0)