@computesdk/docker 1.2.59 → 1.2.61
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/README.md +6 -6
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ const compute = docker({
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
// Create a sandbox and run Python
|
|
47
|
-
const sandbox = await compute.
|
|
47
|
+
const sandbox = await compute.instances.create();
|
|
48
48
|
const result = await sandbox.runCommand('python -c "print(\"Hello from Python\")"');
|
|
49
49
|
console.log(result.stdout.trim()); // Hello from Python
|
|
50
50
|
|
|
@@ -65,7 +65,7 @@ const compute = docker({
|
|
|
65
65
|
},
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
const sandbox = await compute.
|
|
68
|
+
const sandbox = await compute.instances.create();
|
|
69
69
|
|
|
70
70
|
const result = await sandbox.runCommand('node -e "console.log(\"Hello, World!\")"');
|
|
71
71
|
console.log(result.stdout.trim()); // Hello, World!
|
|
@@ -196,7 +196,7 @@ Interactive terminals aren’t exposed. Use `runCommand('…')` for non-interact
|
|
|
196
196
|
### Sandbox Management
|
|
197
197
|
|
|
198
198
|
```ts
|
|
199
|
-
const sandbox = await compute.
|
|
199
|
+
const sandbox = await compute.instances.create();
|
|
200
200
|
|
|
201
201
|
await sandbox.getInfo(); // { id, provider, status, createdAt, timeout, metadata }
|
|
202
202
|
await sandbox.getUrl({ port, protocol?: 'http' | 'https' });
|
|
@@ -225,7 +225,7 @@ if (res.exitCode !== 0) {
|
|
|
225
225
|
### Data Science Workflow (Python)
|
|
226
226
|
|
|
227
227
|
```ts
|
|
228
|
-
const sandbox = await compute.
|
|
228
|
+
const sandbox = await compute.instances.create();
|
|
229
229
|
await sandbox.runCommand('python3 -m pip install --no-cache-dir pandas');
|
|
230
230
|
await sandbox.filesystem.writeFile('/workspace/app.py', `
|
|
231
231
|
import pandas as pd
|
|
@@ -239,7 +239,7 @@ await sandbox.destroy();
|
|
|
239
239
|
### Stateful Loop
|
|
240
240
|
|
|
241
241
|
```ts
|
|
242
|
-
const sandbox = await compute.
|
|
242
|
+
const sandbox = await compute.instances.create();
|
|
243
243
|
await sandbox.runCommand('echo boot > /tmp/state');
|
|
244
244
|
const res = await sandbox.runCommand('cat /tmp/state'); // 'boot'
|
|
245
245
|
await sandbox.destroy();
|
|
@@ -248,7 +248,7 @@ await sandbox.destroy();
|
|
|
248
248
|
### Background Process + Ports
|
|
249
249
|
|
|
250
250
|
```ts
|
|
251
|
-
const sandbox = await compute.
|
|
251
|
+
const sandbox = await compute.instances.create();
|
|
252
252
|
await sandbox.runCommand('python3 -m http.server 8080', { background: true });
|
|
253
253
|
const url = await sandbox.getUrl({ port: 8080 });
|
|
254
254
|
console.log('Serving at', url);
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _computesdk_provider from '@computesdk/provider';
|
|
2
|
+
import * as computesdk from 'computesdk';
|
|
2
3
|
import Docker, { DockerOptions, ContainerCreateOptions, ContainerStartOptions, Container } from 'dockerode';
|
|
3
4
|
|
|
4
5
|
/** When the provider should clean up containers it created */
|
|
@@ -79,6 +80,6 @@ interface DockerSandboxHandle {
|
|
|
79
80
|
createdAt: Date;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
declare const docker: (config: DockerConfig) => _computesdk_provider.Provider<DockerSandboxHandle, any, any>;
|
|
83
|
+
declare const docker: (config: DockerConfig) => _computesdk_provider.Provider<DockerSandboxHandle, any, any, computesdk.Volume>;
|
|
83
84
|
|
|
84
85
|
export { docker };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _computesdk_provider from '@computesdk/provider';
|
|
2
|
+
import * as computesdk from 'computesdk';
|
|
2
3
|
import Docker, { DockerOptions, ContainerCreateOptions, ContainerStartOptions, Container } from 'dockerode';
|
|
3
4
|
|
|
4
5
|
/** When the provider should clean up containers it created */
|
|
@@ -79,6 +80,6 @@ interface DockerSandboxHandle {
|
|
|
79
80
|
createdAt: Date;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
declare const docker: (config: DockerConfig) => _computesdk_provider.Provider<DockerSandboxHandle, any, any>;
|
|
83
|
+
declare const docker: (config: DockerConfig) => _computesdk_provider.Provider<DockerSandboxHandle, any, any, computesdk.Volume>;
|
|
83
84
|
|
|
84
85
|
export { docker };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@computesdk/docker",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.61",
|
|
4
4
|
"description": "Docker provider for ComputeSDK - local containerized sandboxes for development and testing",
|
|
5
5
|
"author": "IberAI",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"dockerode": "^4.0.8",
|
|
22
|
-
"@computesdk/provider": "2.1.
|
|
23
|
-
"computesdk": "4.1.
|
|
22
|
+
"@computesdk/provider": "2.1.15",
|
|
23
|
+
"computesdk": "4.1.13"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"computesdk",
|