@lde/task-runner-docker 0.0.5 → 0.2.0
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 +40 -6
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,11 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Task Runner Docker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Run shell commands inside Docker containers for isolated, reproducible execution.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```typescript
|
|
8
|
+
import { DockerTaskRunner } from '@lde/task-runner-docker';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
const runner = new DockerTaskRunner({
|
|
11
|
+
image: 'ubuntu:latest',
|
|
12
|
+
containerName: 'my-task', // Optional container name
|
|
13
|
+
mountDir: '/path/to/data', // Optional directory to mount at /mount
|
|
14
|
+
port: 8080, // Optional port to expose
|
|
15
|
+
});
|
|
10
16
|
|
|
11
|
-
Run
|
|
17
|
+
// Run a command in the container
|
|
18
|
+
const container = await runner.run('ls -la /mount');
|
|
19
|
+
|
|
20
|
+
// Wait for completion
|
|
21
|
+
const output = await runner.wait(container);
|
|
22
|
+
console.log(output);
|
|
23
|
+
|
|
24
|
+
// Or stop a running container
|
|
25
|
+
await runner.stop(container);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Options
|
|
29
|
+
|
|
30
|
+
| Option | Type | Required | Description |
|
|
31
|
+
| --------------- | -------- | -------- | ---------------------------------------------------- |
|
|
32
|
+
| `image` | `string` | Yes | Docker image to use |
|
|
33
|
+
| `containerName` | `string` | No | Name for the container (auto-removed on restart) |
|
|
34
|
+
| `mountDir` | `string` | No | Host directory to mount at `/mount` in the container |
|
|
35
|
+
| `port` | `number` | No | Port to expose from the container |
|
|
36
|
+
| `docker` | `Docker` | No | Custom Dockerode instance |
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Automatically pulls the Docker image before running
|
|
41
|
+
- Mounts a host directory as `/mount` with the `mountDir` option
|
|
42
|
+
- Runs commands as the current user (UID/GID) for file permissions
|
|
43
|
+
- Exposes ports with `port` option
|
|
44
|
+
- Removes previous containers with the same name on restart
|
|
45
|
+
- Streams container logs to stdout
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/task-runner-docker",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"repository": {
|
|
5
|
-
"url": "https://github.com/ldengine/lde"
|
|
5
|
+
"url": "https://github.com/ldengine/lde",
|
|
6
|
+
"directory": "packages/task-runner-docker"
|
|
6
7
|
},
|
|
7
8
|
"type": "module",
|
|
8
9
|
"exports": {
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
"!**/*.tsbuildinfo"
|
|
23
24
|
],
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@lde/task-runner": "0.0
|
|
26
|
+
"@lde/task-runner": "0.2.0",
|
|
26
27
|
"dockerode": "^4.0.7",
|
|
27
28
|
"tslib": "^2.3.0"
|
|
28
29
|
},
|