@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.cjs
CHANGED
|
@@ -308,7 +308,8 @@ var ContainerManager = class {
|
|
|
308
308
|
const startTime = Date.now();
|
|
309
309
|
try {
|
|
310
310
|
const port = container.port ? parseInt(container.port) : 8081;
|
|
311
|
-
const
|
|
311
|
+
const containerHost = process.env.DOCKER_NETWORK ? `noosphere-${container.id}` : "localhost";
|
|
312
|
+
const url = `http://${containerHost}:${port}/computation`;
|
|
312
313
|
let requestBody;
|
|
313
314
|
try {
|
|
314
315
|
const parsedInput = JSON.parse(input);
|
|
@@ -531,6 +532,7 @@ var ContainerManager = class {
|
|
|
531
532
|
}
|
|
532
533
|
} catch (err) {
|
|
533
534
|
}
|
|
535
|
+
const dockerNetwork = process.env.DOCKER_NETWORK;
|
|
534
536
|
const createOptions = {
|
|
535
537
|
name: containerName,
|
|
536
538
|
Image: imageTag,
|
|
@@ -541,9 +543,12 @@ var ContainerManager = class {
|
|
|
541
543
|
HostConfig: {
|
|
542
544
|
AutoRemove: false,
|
|
543
545
|
// Keep container for reuse
|
|
544
|
-
|
|
546
|
+
// Only bind ports to host when not using Docker network (local dev)
|
|
547
|
+
PortBindings: metadata.port && !dockerNetwork ? {
|
|
545
548
|
[`${metadata.port}/tcp`]: [{ HostPort: metadata.port }]
|
|
546
|
-
} : void 0
|
|
549
|
+
} : void 0,
|
|
550
|
+
// Join the specified Docker network for DinD communication
|
|
551
|
+
NetworkMode: dockerNetwork || void 0
|
|
547
552
|
},
|
|
548
553
|
Env: metadata.env ? Object.entries(metadata.env).map(([k, v]) => `${k}=${v}`) : void 0
|
|
549
554
|
};
|