Merge c308410d80b803d50b2beffe59deee1df916df11 into 43513cd1df63af0704dfb351ee7864607f955dcc

This commit is contained in:
Tomi 2026-03-21 05:45:08 +00:00 committed by GitHub
commit 1245c99f34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -261,9 +261,19 @@ export async function ensureDockerImage(image: string) {
return;
}
if (image === DEFAULT_SANDBOX_IMAGE) {
await execDocker(["pull", "debian:bookworm-slim"]);
await execDocker(["tag", "debian:bookworm-slim", DEFAULT_SANDBOX_IMAGE]);
return;
// Prefer the pre-built image from GitHub Container Registry (contains python3 + tools).
// Falls back to building locally from Dockerfile.sandbox if the registry pull fails.
const registryImage = "ghcr.io/openclaw/openclaw:main-slim-amd64";
try {
await execDocker(["pull", registryImage]);
await execDocker(["tag", registryImage, DEFAULT_SANDBOX_IMAGE]);
return;
} catch {
// Registry pull failed; build locally from the included Dockerfile.sandbox
const dockerfilePath = process.cwd() + "/Dockerfile.sandbox";
await execDocker(["build", "-t", DEFAULT_SANDBOX_IMAGE, "-f", dockerfilePath, "."]);
return;
}
}
throw new Error(`Sandbox image not found: ${image}. Build or pull it first.`);
}