@zooid/runtime-docker 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zooid/runtime-docker",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Docker runtime for zooid. Spawns the agent CLI inside a container with a workspace mount and an env allowlist.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"node": ">=22"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@zooid/core": "^0.7.
|
|
28
|
+
"@zooid/core": "^0.7.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.0.0",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process'
|
|
2
|
+
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
3
|
+
import { tmpdir } from 'node:os'
|
|
4
|
+
import { join } from 'node:path'
|
|
5
|
+
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
|
|
6
|
+
import { DockerAcpRuntime } from './docker-acp.js'
|
|
7
|
+
|
|
8
|
+
function dockerAvailable(): boolean {
|
|
9
|
+
try {
|
|
10
|
+
execSync('docker info', { stdio: 'ignore' })
|
|
11
|
+
return true
|
|
12
|
+
} catch {
|
|
13
|
+
return false
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe.skipIf(!dockerAvailable())('DockerAcpRuntime — real bind mount', () => {
|
|
18
|
+
let workDir: string
|
|
19
|
+
beforeAll(() => {
|
|
20
|
+
workDir = mkdtempSync(join(tmpdir(), 'zooid-mount-smoke-'))
|
|
21
|
+
writeFileSync(join(workDir, 'marker.txt'), 'hello-from-host')
|
|
22
|
+
execSync('docker pull alpine:3', { stdio: 'ignore' })
|
|
23
|
+
}, 60_000)
|
|
24
|
+
afterAll(() => rmSync(workDir, { recursive: true, force: true }))
|
|
25
|
+
|
|
26
|
+
it("`docker run` with a bind mount sees the host file's contents", async () => {
|
|
27
|
+
const rt = new DockerAcpRuntime({ defaultImage: 'alpine:3' })
|
|
28
|
+
const child = rt.spawn({
|
|
29
|
+
command: 'cat',
|
|
30
|
+
args: ['/work/marker.txt'],
|
|
31
|
+
cwd: '/',
|
|
32
|
+
mounts: [{ path: workDir, target: '/work', mode: 'ro' }],
|
|
33
|
+
})
|
|
34
|
+
const stdout = await new Promise<string>((resolve, reject) => {
|
|
35
|
+
let buf = ''
|
|
36
|
+
child.stdout!.on('data', (d) => {
|
|
37
|
+
buf += String(d)
|
|
38
|
+
})
|
|
39
|
+
child.on('close', (code) =>
|
|
40
|
+
code === 0 ? resolve(buf) : reject(new Error(`exit ${code}`)),
|
|
41
|
+
)
|
|
42
|
+
child.on('error', reject)
|
|
43
|
+
})
|
|
44
|
+
expect(stdout.trim()).toBe('hello-from-host')
|
|
45
|
+
}, 30_000)
|
|
46
|
+
})
|