mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-23 20:21:03 +02:00
New macros working with Docker Compose
This commit is contained in:
parent
0369072bdd
commit
ed605f03f9
1 changed files with 36 additions and 2 deletions
|
|
@ -18,12 +18,15 @@
|
||||||
reservations: {},
|
reservations: {},
|
||||||
ports: [],
|
ports: [],
|
||||||
volumes: [],
|
volumes: [],
|
||||||
|
environment: {},
|
||||||
|
|
||||||
with_image:: function(x) self + { image: x },
|
with_image:: function(x) self + { image: x },
|
||||||
|
|
||||||
with_command:: function(x) self + { command: x },
|
with_command:: function(x) self + { command: x },
|
||||||
|
|
||||||
with_environment:: function(x) self + { environment: x },
|
with_environment:: function(x) self + {
|
||||||
|
environment: super.environment + x,
|
||||||
|
},
|
||||||
|
|
||||||
with_limits:: function(c, m) self + { limits: { cpus: c, memory: m } },
|
with_limits:: function(c, m) self + { limits: { cpus: c, memory: m } },
|
||||||
|
|
||||||
|
|
@ -45,6 +48,16 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
with_env_var_secrets::
|
||||||
|
function(vars)
|
||||||
|
std.foldl(
|
||||||
|
function(obj, x) obj.with_environment(
|
||||||
|
{ [x]: "${" + x + "}" }
|
||||||
|
),
|
||||||
|
vars.variables,
|
||||||
|
self
|
||||||
|
),
|
||||||
|
|
||||||
add:: function() {
|
add:: function() {
|
||||||
services +: {
|
services +: {
|
||||||
[container.name]: {
|
[container.name]: {
|
||||||
|
|
@ -62,7 +75,7 @@
|
||||||
{ command: container.command }
|
{ command: container.command }
|
||||||
else {}) +
|
else {}) +
|
||||||
|
|
||||||
(if std.objectHas(container, "environment") then
|
(if ! std.isEmpty(container.environment) then
|
||||||
{ environment: container.environment }
|
{ environment: container.environment }
|
||||||
else {}) +
|
else {}) +
|
||||||
|
|
||||||
|
|
@ -170,6 +183,27 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
envSecrets:: function(name)
|
||||||
|
{
|
||||||
|
|
||||||
|
local volume = self,
|
||||||
|
|
||||||
|
name: name,
|
||||||
|
|
||||||
|
volid:: name,
|
||||||
|
|
||||||
|
variables:: [],
|
||||||
|
|
||||||
|
with_env_var::
|
||||||
|
function(name) self + {
|
||||||
|
variables: super.variables + [name],
|
||||||
|
},
|
||||||
|
|
||||||
|
add:: function() {
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
containers:: function(name, containers)
|
containers:: function(name, containers)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue