WIP: Add some portrange support
This commit is contained in:
@@ -289,16 +289,25 @@ async function createSubcontainer(app, name, cmd, options) {
|
||||
const portType = (manifest.tcpPorts && portName in manifest.tcpPorts) ? 'tcp' : 'udp';
|
||||
const ports = portType == 'tcp' ? manifest.tcpPorts : manifest.udpPorts;
|
||||
|
||||
const containerPort = ports[portName].containerPort || hostPort;
|
||||
let portCount = 1;
|
||||
if (portName === 'sfuTcp' || portName === 'sfuUdp') portCount = 100;
|
||||
|
||||
const containerPort = ports[portName].containerPort || hostPort;
|
||||
const hostIps = hostPort === 53 ? getAddressesForPort53() : [ '0.0.0.0', '::0' ]; // port 53 is special because it is possibly taken by systemd-resolved
|
||||
|
||||
// docker portBindings requires ports to be exposed
|
||||
exposedPorts[`${containerPort}/${portType}`] = {};
|
||||
portEnv.push(`${portName}=${hostPort}`);
|
||||
|
||||
const hostIps = hostPort === 53 ? getAddressesForPort53() : [ '0.0.0.0', '::0' ]; // port 53 is special because it is possibly taken by systemd-resolved
|
||||
dockerPortBindings[`${containerPort}/${portType}`] = hostIps.map(hip => { return { HostIp: hip, HostPort: hostPort + '' }; });
|
||||
// docker portBindings requires ports to be exposed
|
||||
for (let i = 0; i < portCount; ++i) {
|
||||
exposedPorts[`${containerPort+i}/${portType}`] = {};
|
||||
dockerPortBindings[`${containerPort+i}/${portType}`] = hostIps.map(hip => { return { HostIp: hip, HostPort: (hostPort + i) + '' }; });
|
||||
}
|
||||
}
|
||||
|
||||
console.log('=== env', portEnv)
|
||||
console.log('=== bindings', dockerPortBindings)
|
||||
console.log('=== exposedPorts', exposedPorts)
|
||||
|
||||
const appEnv = [];
|
||||
Object.keys(app.env).forEach(function (name) { appEnv.push(`${name}=${app.env[name]}`); });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user