mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 10:05:18 +00:00
Configure lefthook formatter checks (#231)
* Add lefthook formatter checks * Fix SDK mode hydration * Stabilize SDK mode integration test
This commit is contained in:
parent
0471214d65
commit
d2346bafb3
282 changed files with 5840 additions and 8399 deletions
|
|
@ -11,17 +11,14 @@ setupImage();
|
|||
|
||||
console.log("Creating BoxLite sandbox...");
|
||||
const box = new SimpleBox({
|
||||
rootfsPath: OCI_DIR,
|
||||
env,
|
||||
ports: [{ hostPort: 3000, guestPort: 3000 }],
|
||||
diskSizeGb: 4,
|
||||
rootfsPath: OCI_DIR,
|
||||
env,
|
||||
ports: [{ hostPort: 3000, guestPort: 3000 }],
|
||||
diskSizeGb: 4,
|
||||
});
|
||||
|
||||
console.log("Starting server...");
|
||||
const result = await box.exec(
|
||||
"sh", "-c",
|
||||
"nohup sandbox-agent server --no-token --host 0.0.0.0 --port 3000 >/tmp/sandbox-agent.log 2>&1 &",
|
||||
);
|
||||
const result = await box.exec("sh", "-c", "nohup sandbox-agent server --no-token --host 0.0.0.0 --port 3000 >/tmp/sandbox-agent.log 2>&1 &");
|
||||
if (result.exitCode !== 0) throw new Error(`Failed to start server: ${result.stderr}`);
|
||||
|
||||
const baseUrl = "http://localhost:3000";
|
||||
|
|
@ -36,9 +33,9 @@ console.log(" Press Ctrl+C to stop.");
|
|||
|
||||
const keepAlive = setInterval(() => {}, 60_000);
|
||||
const cleanup = async () => {
|
||||
clearInterval(keepAlive);
|
||||
await box.stop();
|
||||
process.exit(0);
|
||||
clearInterval(keepAlive);
|
||||
await box.stop();
|
||||
process.exit(0);
|
||||
};
|
||||
process.once("SIGINT", cleanup);
|
||||
process.once("SIGTERM", cleanup);
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ export const DOCKER_IMAGE = "sandbox-agent-boxlite";
|
|||
export const OCI_DIR = new URL("../oci-image", import.meta.url).pathname;
|
||||
|
||||
export function setupImage() {
|
||||
console.log(`Building image "${DOCKER_IMAGE}" (cached after first run)...`);
|
||||
execSync(`docker build -t ${DOCKER_IMAGE} ${new URL("..", import.meta.url).pathname}`, { stdio: "inherit" });
|
||||
console.log(`Building image "${DOCKER_IMAGE}" (cached after first run)...`);
|
||||
execSync(`docker build -t ${DOCKER_IMAGE} ${new URL("..", import.meta.url).pathname}`, { stdio: "inherit" });
|
||||
|
||||
if (!existsSync(`${OCI_DIR}/oci-layout`)) {
|
||||
console.log("Exporting to OCI layout...");
|
||||
mkdirSync(OCI_DIR, { recursive: true });
|
||||
execSync(`docker save ${DOCKER_IMAGE} | tar -xf - -C ${OCI_DIR}`, { stdio: "inherit" });
|
||||
}
|
||||
if (!existsSync(`${OCI_DIR}/oci-layout`)) {
|
||||
console.log("Exporting to OCI layout...");
|
||||
mkdirSync(OCI_DIR, { recursive: true });
|
||||
execSync(`docker save ${DOCKER_IMAGE} | tar -xf - -C ${OCI_DIR}`, { stdio: "inherit" });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue