






















@@ -258,13 +258,13 @@ describe("scripts/docker/setup.sh", () => {
258258const activeSandbox = requireSandbox(sandbox);
259259260260const result = runDockerSetup(activeSandbox, {
261-OPENCLAW_DOCKER_APT_PACKAGES: "ffmpeg build-essential",
261+OPENCLAW_DOCKER_APT_PACKAGES: "curl wget",
262262OPENCLAW_EXTRA_MOUNTS: undefined,
263263OPENCLAW_HOME_VOLUME: "openclaw-home",
264264});
265265expect(result.status).toBe(0);
266266const envFile = await readFile(join(activeSandbox.rootDir, ".env"), "utf8");
267-expect(envFile).toContain("OPENCLAW_DOCKER_APT_PACKAGES=ffmpeg build-essential");
267+expect(envFile).toContain("OPENCLAW_IMAGE_APT_PACKAGES=curl wget");
268268expect(envFile).toContain("OPENCLAW_EXTRA_MOUNTS=");
269269expect(envFile).toContain("OPENCLAW_HOME_VOLUME=openclaw-home"); // pragma: allowlist secret
270270expect(envFile).toContain("OPENCLAW_DISABLE_BONJOUR=");
@@ -282,7 +282,7 @@ describe("scripts/docker/setup.sh", () => {
282282expect(extraCompose).toContain("volumes:");
283283expect(extraCompose).toContain("openclaw-home:");
284284const log = await readDockerLog(activeSandbox);
285-expect(log).toContain("--build-arg OPENCLAW_DOCKER_APT_PACKAGES=ffmpeg build-essential");
285+expect(log).toContain("--build-arg OPENCLAW_IMAGE_APT_PACKAGES=curl wget");
286286expect(log).toContain(
287287`run --rm --no-deps ${prestartContainerEnvFlags} --entrypoint node openclaw-gateway dist/index.js onboard --mode local --no-install-daemon`,
288288);
@@ -304,6 +304,61 @@ describe("scripts/docker/setup.sh", () => {
304304expect(envFile).toContain("OPENCLAW_DISABLE_BONJOUR=0");
305305});
306306307+it("normalizes legacy OPENCLAW_DOCKER_APT_PACKAGES into OPENCLAW_IMAGE_APT_PACKAGES", async () => {
308+const activeSandbox = requireSandbox(sandbox);
309+await resetDockerLog(activeSandbox);
310+311+const result = runDockerSetup(activeSandbox, {
312+OPENCLAW_DOCKER_APT_PACKAGES: "curl wget",
313+});
314+expect(result.status).toBe(0);
315+316+const envFile = await readFile(join(activeSandbox.rootDir, ".env"), "utf8");
317+expect(envFile).toContain("OPENCLAW_IMAGE_APT_PACKAGES=curl wget");
318+expect(envFile).not.toContain("OPENCLAW_DOCKER_APT_PACKAGES");
319+320+const log = await readDockerLog(activeSandbox);
321+expect(log).toContain("--build-arg OPENCLAW_IMAGE_APT_PACKAGES=curl wget");
322+expect(log).not.toContain("--build-arg OPENCLAW_DOCKER_APT_PACKAGES");
323+});
324+325+it("prefers OPENCLAW_IMAGE_APT_PACKAGES over legacy OPENCLAW_DOCKER_APT_PACKAGES", async () => {
326+const activeSandbox = requireSandbox(sandbox);
327+await resetDockerLog(activeSandbox);
328+329+const result = runDockerSetup(activeSandbox, {
330+OPENCLAW_IMAGE_APT_PACKAGES: "curl wget httpie",
331+OPENCLAW_DOCKER_APT_PACKAGES: "curl wget",
332+});
333+expect(result.status).toBe(0);
334+335+const envFile = await readFile(join(activeSandbox.rootDir, ".env"), "utf8");
336+expect(envFile).toContain("OPENCLAW_IMAGE_APT_PACKAGES=curl wget httpie");
337+expect(envFile).not.toContain("OPENCLAW_DOCKER_APT_PACKAGES");
338+339+const log = await readDockerLog(activeSandbox);
340+expect(log).toContain("--build-arg OPENCLAW_IMAGE_APT_PACKAGES=curl wget httpie");
341+expect(log).not.toMatch(/--build-arg OPENCLAW_IMAGE_APT_PACKAGES=curl wget(?! httpie)/);
342+});
343+344+it("explicitly empty OPENCLAW_IMAGE_APT_PACKAGES suppresses legacy fallback", async () => {
345+const activeSandbox = requireSandbox(sandbox);
346+await resetDockerLog(activeSandbox);
347+348+const result = runDockerSetup(activeSandbox, {
349+OPENCLAW_IMAGE_APT_PACKAGES: "",
350+OPENCLAW_DOCKER_APT_PACKAGES: "curl wget",
351+});
352+expect(result.status).toBe(0);
353+354+const envFile = await readFile(join(activeSandbox.rootDir, ".env"), "utf8");
355+expect(envFile).toContain("OPENCLAW_IMAGE_APT_PACKAGES=");
356+expect(envFile).not.toContain("curl wget");
357+358+const log = await readDockerLog(activeSandbox);
359+expect(log).not.toContain("--build-arg OPENCLAW_IMAGE_APT_PACKAGES=curl wget");
360+});
361+307362it("avoids shared-network openclaw-cli before the gateway is started", async () => {
308363const activeSandbox = requireSandbox(sandbox);
309364@@ -742,4 +797,19 @@ describe("scripts/docker/setup.sh", () => {
742797compose.match(/OPENCLAW_WORKSPACE_DIR: \/home\/node\/\.openclaw\/workspace$/gm),
743798).toHaveLength(2);
744799});
800+801+it("Dockerfile ARG OPENCLAW_IMAGE_APT_PACKAGES must not have a default value", async () => {
802+// If the ARG has a default (e.g. ARG OPENCLAW_IMAGE_APT_PACKAGES=""), Docker treats it as
803+// "set" even when no --build-arg is passed. That breaks the RUN fallback expression
804+// ${OPENCLAW_IMAGE_APT_PACKAGES-$OPENCLAW_DOCKER_APT_PACKAGES} because the variable is
805+// never truly unset, so legacy-only callers using --build-arg OPENCLAW_DOCKER_APT_PACKAGES
806+// get nothing installed — a backward-compat regression.
807+const dockerfile = await readFile(join(repoRoot, "Dockerfile"), "utf8");
808+const argLine = dockerfile
809+.split("\n")
810+.find((line) => line.startsWith("ARG OPENCLAW_IMAGE_APT_PACKAGES"));
811+expect(argLine).toBeDefined();
812+// Must be bare `ARG OPENCLAW_IMAGE_APT_PACKAGES` with no default assignment
813+expect(argLine).toBe("ARG OPENCLAW_IMAGE_APT_PACKAGES");
814+});
745815});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。