Skip to content

Commit a461d42

Browse files
feat: update openclaw action
1 parent d3d03da commit a461d42

2 files changed

Lines changed: 43 additions & 8 deletions

File tree

.github/workflows/openclaw-release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ jobs:
5656
file: openclaw/Dockerfile
5757
platforms: ${{ github.event.inputs.platforms || 'linux/amd64,linux/arm64/v8' }}
5858
push: true
59+
build-args: |
60+
OPENCLAW_INSTALL_BROWSER=true
61+
OPENCLAW_VERSION=${{ github.event.inputs.openclawTag }}
5962
tags: |
6063
1panel/openclaw:${{ github.event.inputs.dockerhubTag || github.event.inputs.openclawTag }}
6164
cache-from: type=gha
@@ -69,6 +72,9 @@ jobs:
6972
file: openclaw/Dockerfile
7073
platforms: ${{ github.event.inputs.platforms || 'linux/amd64,linux/arm64/v8' }}
7174
push: true
75+
build-args: |
76+
OPENCLAW_INSTALL_BROWSER=true
77+
OPENCLAW_VERSION=${{ github.event.inputs.openclawTag }}
7278
tags: |
7379
1panel/openclaw:latest
7480
cache-from: type=gha

openclaw/Dockerfile

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ENV PATH="/root/.bun/bin:${PATH}"
77
RUN corepack enable
88

99
WORKDIR /app
10+
RUN chown node:node /app
1011

1112
ARG OPENCLAW_DOCKER_APT_PACKAGES=""
1213
RUN if [ -n "$OPENCLAW_DOCKER_APT_PACKAGES" ]; then \
@@ -16,23 +17,47 @@ RUN if [ -n "$OPENCLAW_DOCKER_APT_PACKAGES" ]; then \
1617
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*; \
1718
fi
1819

19-
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
20-
COPY ui/package.json ./ui/package.json
21-
COPY patches ./patches
22-
COPY scripts ./scripts
20+
COPY --chown=node:node package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
21+
COPY --chown=node:node ui/package.json ./ui/package.json
22+
COPY --chown=node:node patches ./patches
23+
COPY --chown=node:node scripts ./scripts
2324

25+
USER node
2426
RUN pnpm install --frozen-lockfile
2527

26-
COPY . .
28+
# Optionally install Chromium and Xvfb for browser automation.
29+
# Build with: docker build --build-arg OPENCLAW_INSTALL_BROWSER=1 ...
30+
# Adds ~300MB but eliminates the 60-90s Playwright install on every container start.
31+
# Must run after pnpm install so playwright-core is available in node_modules.
32+
USER root
33+
ARG OPENCLAW_INSTALL_BROWSER=""
34+
RUN if [ -n "$OPENCLAW_INSTALL_BROWSER" ]; then \
35+
apt-get update && \
36+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends xvfb && \
37+
mkdir -p /home/node/.cache/ms-playwright && \
38+
PLAYWRIGHT_BROWSERS_PATH=/home/node/.cache/ms-playwright \
39+
node /app/node_modules/playwright-core/cli.js install --with-deps chromium && \
40+
chown -R node:node /home/node/.cache/ms-playwright && \
41+
apt-get clean && \
42+
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*; \
43+
fi
44+
45+
USER node
46+
COPY --chown=node:node . .
2747
RUN pnpm build
2848
# Force pnpm for UI build (Bun may fail on ARM/Synology architectures)
2949
ENV OPENCLAW_PREFER_PNPM=1
3050
RUN pnpm ui:build
3151

52+
ARG OPENCLAW_VERSION=""
53+
ENV OPENCLAW_VERSION=$OPENCLAW_VERSION
54+
ENV OPENCLAW_SERVICE_VERSION=$OPENCLAW_VERSION
55+
3256
ENV NODE_ENV=production
3357

3458
# ---- add openclaw command ----
3559
# Makes `openclaw ...` == `node /app/dist/index.js ...`
60+
USER root
3661
RUN printf '%s\n' \
3762
'#!/bin/sh' \
3863
'set -e' \
@@ -41,11 +66,15 @@ RUN printf '%s\n' \
4166
&& chmod +x /usr/local/bin/openclaw
4267
# -----------------------------
4368

44-
# Allow non-root user to write temp files during runtime/tests.
45-
RUN chown -R node:node /app
46-
4769
# Security hardening: Run as non-root user
70+
# The node:22-bookworm image includes a 'node' user (uid 1000)
71+
# This reduces the attack surface by preventing container escape via root privileges
4872
USER node
4973

5074
# Start gateway server with default config.
75+
# Binds to loopback (127.0.0.1) by default for security.
76+
#
77+
# For container platforms requiring external health checks:
78+
# 1. Set OPENCLAW_GATEWAY_TOKEN or OPENCLAW_GATEWAY_PASSWORD env var
79+
# 2. Override CMD: ["node","openclaw.mjs","gateway","--allow-unconfigured","--bind","lan"]
5180
CMD ["openclaw", "gateway", "--allow-unconfigured"]

0 commit comments

Comments
 (0)