@noosphere/agent-core 0.1.0-alpha.3 → 0.1.0-alpha.5
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/dist/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -269,7 +269,8 @@ var ContainerManager = class {
|
|
|
269
269
|
const startTime = Date.now();
|
|
270
270
|
try {
|
|
271
271
|
const port = container.port ? parseInt(container.port) : 8081;
|
|
272
|
-
const
|
|
272
|
+
const containerHost = process.env.DOCKER_NETWORK ? `noosphere-${container.id}` : "localhost";
|
|
273
|
+
const url = `http://${containerHost}:${port}/computation`;
|
|
273
274
|
let requestBody;
|
|
274
275
|
try {
|
|
275
276
|
const parsedInput = JSON.parse(input);
|
|
@@ -492,6 +493,7 @@ var ContainerManager = class {
|
|
|
492
493
|
}
|
|
493
494
|
} catch (err) {
|
|
494
495
|
}
|
|
496
|
+
const dockerNetwork = process.env.DOCKER_NETWORK;
|
|
495
497
|
const createOptions = {
|
|
496
498
|
name: containerName,
|
|
497
499
|
Image: imageTag,
|
|
@@ -502,9 +504,12 @@ var ContainerManager = class {
|
|
|
502
504
|
HostConfig: {
|
|
503
505
|
AutoRemove: false,
|
|
504
506
|
// Keep container for reuse
|
|
505
|
-
|
|
507
|
+
// Only bind ports to host when not using Docker network (local dev)
|
|
508
|
+
PortBindings: metadata.port && !dockerNetwork ? {
|
|
506
509
|
[`${metadata.port}/tcp`]: [{ HostPort: metadata.port }]
|
|
507
|
-
} : void 0
|
|
510
|
+
} : void 0,
|
|
511
|
+
// Join the specified Docker network for DinD communication
|
|
512
|
+
NetworkMode: dockerNetwork || void 0
|
|
508
513
|
},
|
|
509
514
|
Env: metadata.env ? Object.entries(metadata.env).map(([k, v]) => `${k}=${v}`) : void 0
|
|
510
515
|
};
|