Skip to content

Commit 0b2d096

Browse files
feat: update openclaw Dockerfile
1 parent a13cfb6 commit 0b2d096

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

openclaw/Dockerfile

Lines changed: 15 additions & 12 deletions
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_DOCKER_APT_UPGRADE=1
1718
ARG OPENCLAW_CADDY_IMAGE="caddy:2"
1819
ARG OPENCLAW_NODE_BOOKWORM_IMAGE="node:24-bookworm@sha256:3a09aa6354567619221ef6c45a5051b671f953f0a1924d1f819ffb236e520e6b"
1920
ARG OPENCLAW_NODE_BOOKWORM_DIGEST="sha256:3a09aa6354567619221ef6c45a5051b671f953f0a1924d1f819ffb236e520e6b"
@@ -114,6 +115,7 @@ LABEL org.opencontainers.image.base.name="docker.io/library/node:24-bookworm-sli
114115

115116
FROM base-${OPENCLAW_VARIANT}
116117
ARG OPENCLAW_VARIANT
118+
ARG OPENCLAW_DOCKER_APT_UPGRADE
117119

118120
# OCI base-image metadata for downstream image consumers.
119121
# If you change these annotations, also update:
@@ -130,12 +132,16 @@ WORKDIR /app
130132

131133
# Install system utilities present in bookworm but missing in bookworm-slim.
132134
# On the full bookworm image these are already installed (apt-get is a no-op).
135+
# Smoke workflows can opt out of distro upgrades to cut repeated CI time while
136+
# keeping the default runtime image behavior unchanged.
133137
RUN --mount=type=cache,id=openclaw-bookworm-apt-cache,target=/var/cache/apt,sharing=locked \
134138
--mount=type=cache,id=openclaw-bookworm-apt-lists,target=/var/lib/apt,sharing=locked \
135139
apt-get update && \
136-
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --no-install-recommends && \
140+
if [ "${OPENCLAW_DOCKER_APT_UPGRADE}" != "0" ]; then \
141+
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --no-install-recommends; \
142+
fi && \
137143
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
138-
procps hostname curl git openssl python3 python-is-python3
144+
procps hostname curl git lsof openssl python3 python-is-python3
139145

140146
RUN chown node:node /app
141147

@@ -150,6 +156,10 @@ COPY --from=caddy-binary /usr/bin/caddy /usr/bin/caddy
150156
COPY openclaw/Caddyfile /etc/caddy/Caddyfile
151157
COPY openclaw/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
152158

159+
# In npm-installed Docker images, prefer the copied source extension tree for
160+
# bundled discovery so package metadata that points at source entries stays valid.
161+
ENV OPENCLAW_BUNDLED_PLUGINS_DIR=/app/extensions
162+
153163
# Keep pnpm available in the runtime image for container-local workflows.
154164
# Use a shared Corepack home so the non-root `node` user does not need a
155165
# first-run network fetch when invoking pnpm.
@@ -228,17 +238,10 @@ RUN --mount=type=cache,id=openclaw-bookworm-apt-cache,target=/var/cache/apt,shar
228238
docker-ce-cli docker-compose-plugin; \
229239
fi
230240

231-
# ---- add openclaw command ----
232-
# Keeps the customized CMD shape while following the upstream launcher.
233-
RUN printf '%s\n' \
234-
'#!/bin/sh' \
235-
'set -e' \
236-
'exec node /app/openclaw.mjs "$@"' \
237-
> /usr/local/bin/openclaw && \
241+
RUN ln -sf /app/openclaw.mjs /usr/local/bin/openclaw && \
238242
install -d -o node -g node /data /config /etc/caddy /tmp/caddy && \
239-
chmod 755 /usr/local/bin/openclaw /usr/local/bin/docker-entrypoint.sh /usr/bin/caddy /app/openclaw.mjs && \
243+
chmod 755 /usr/local/bin/docker-entrypoint.sh /usr/bin/caddy /app/openclaw.mjs && \
240244
chown -R node:node /data /config /etc/caddy /tmp/caddy
241-
# -----------------------------
242245

243246
ENV CADDY_HTTPS_PORT=8443
244247
ENV CADDY_SITE_ADDRESS=127.0.0.1
@@ -266,4 +269,4 @@ HEALTHCHECK --interval=3m --timeout=10s --start-period=15s --retries=3 \
266269

267270
EXPOSE 8443
268271
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
269-
CMD ["openclaw", "gateway", "--allow-unconfigured"]
272+
CMD ["node", "openclaw.mjs", "gateway", "--allow-unconfigured"]

0 commit comments

Comments
 (0)