dockerode-compose
Advanced tools
Comparing version 1.3.3 to 1.4.0
@@ -174,3 +174,3 @@ const tools = require('./tools'); | ||
if (service.networks !== undefined) { | ||
servicesTools.buildNetworks(projectName, serviceName, service.networks, networksToAttach, opts); | ||
servicesTools.buildNetworks(projectName, serviceName, service.networks, networksToAttach, opts, recipe.networks); | ||
} else { | ||
@@ -177,0 +177,0 @@ opts.HostConfig.NetworkMode = projectName + '_default'; |
@@ -186,3 +186,9 @@ const fs = require('fs'); | ||
} | ||
if (service.devices !== undefined) { | ||
output.Devices = service.devices.map((device) => ({ | ||
CgroupPermissions: "mrw", | ||
PathInContainer: device, | ||
PathOnHost: device, | ||
})); | ||
} | ||
if (service.cpu_count !== undefined) { | ||
@@ -490,6 +496,15 @@ output.CpuCount = service.cpu_count; | ||
buildNetworks: function (projectName, serviceName, serviceNetworks, networksToAttach, opts) { | ||
buildNetworks: function (projectName, serviceName, serviceNetworks, networksToAttach, opts, toplevelNetworks) { | ||
if (Array.isArray(serviceNetworks)) { | ||
for (let index = 0; index < serviceNetworks.length; index++) { | ||
let networkName = projectName + '_' + serviceNetworks[index]; | ||
// check if network is external | ||
if (toplevelNetworks !== undefined) { | ||
if (Object.keys(toplevelNetworks).includes(serviceNetworks[index])) { | ||
if (toplevelNetworks[serviceNetworks[index]].external === true) { | ||
// it is external network | ||
networkName = toplevelNetworks[serviceNetworks[index]].name | ||
} | ||
} | ||
} | ||
let networkTemplate = { | ||
@@ -514,3 +529,12 @@ NetworkingConfig: { | ||
let network = serviceNetworks[networkNames[index]] || {}; | ||
let networkName = projectName + '_' + networkNames[index]; | ||
let networkName = projectName + '_' + serviceNetworks[index]; | ||
// check if network is external | ||
if (toplevelNetworks !== undefined) { | ||
if (Object.keys(toplevelNetworks).includes(networkNames[index])) { | ||
if (toplevelNetworks[networkNames[index]].external === true) { | ||
// it is external network | ||
networkName = toplevelNetworks[networkNames[index]].name | ||
} | ||
} | ||
} | ||
let networkTemplate = { | ||
@@ -517,0 +541,0 @@ NetworkingConfig: { |
{ | ||
"name": "dockerode-compose", | ||
"version": "1.3.3", | ||
"version": "1.4.0", | ||
"description": "docker-compose in nodejs using dockerode", | ||
"main": "./compose.js", | ||
"scripts": { | ||
"test": "./node_modules/mocha/bin/mocha -R spec --exit" | ||
"test": "./node_modules/mocha/bin/mocha.js -R spec --exit" | ||
}, | ||
@@ -24,3 +24,3 @@ "repository": { | ||
"dependencies": { | ||
"dockerode": "^3.3.0", | ||
"dockerode": "^4.0.0", | ||
"js-yaml": "^4.0.0", | ||
@@ -32,4 +32,4 @@ "tar-fs": "^2.1.1" | ||
"memorystream": "~0.3.0", | ||
"mocha": "^7.1.0" | ||
"mocha": "^10.2.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83015
1786
+ Addeddocker-modem@5.0.3(transitive)
+ Addeddockerode@4.0.2(transitive)
- Removeddocker-modem@3.0.8(transitive)
- Removeddockerode@3.3.5(transitive)
Updateddockerode@^4.0.0