Class: Dry::ServiceFunction
- Inherits:
-
Object
- Object
- Dry::ServiceFunction
- Defined in:
- lib/dry-stack/stack.rb
Instance Method Summary collapse
- #command(cmd) ⇒ Object
- #config(name = nil, opts) ⇒ Object
- #deploy(opts) ⇒ Object
- #deploy_label(str) ⇒ Object
- #dns(dns) ⇒ Object
- #entrypoint(cmd) ⇒ Object
- #env(variables) ⇒ Object
- #image(name) ⇒ Object
- #ingress(ing) ⇒ Object
-
#initialize(service) ⇒ ServiceFunction
constructor
A new instance of ServiceFunction.
- #logging(opts) ⇒ Object
- #network(name, opts = {}) ⇒ Object
- #ports(ports) ⇒ Object
-
#user(user) ⇒ Object
“$UID:$GID”, “www-data:www-data”.
- #volume(opts) ⇒ Object
Constructor Details
#initialize(service) ⇒ ServiceFunction
Returns a new instance of ServiceFunction.
72 |
# File 'lib/dry-stack/stack.rb', line 72 def initialize(service, &); @service = service; instance_exec(&) end |
Instance Method Details
#command(cmd) ⇒ Object
78 |
# File 'lib/dry-stack/stack.rb', line 78 def command(cmd)= @service[:command] = cmd |
#config(name = nil, opts) ⇒ Object
82 |
# File 'lib/dry-stack/stack.rb', line 82 def config(name = nil, opts)= (@service[:configs] ||= []) << {source: name.to_s}.merge(opts) |
#deploy(opts) ⇒ Object
81 |
# File 'lib/dry-stack/stack.rb', line 81 def deploy(opts)=@service[:deploy].merge! (opts) |
#deploy_label(str) ⇒ Object
80 |
# File 'lib/dry-stack/stack.rb', line 80 def deploy_label(str)= @service[:deploy][:labels] << str |
#dns(dns) ⇒ Object
74 |
# File 'lib/dry-stack/stack.rb', line 74 def dns(dns)= ((@service[:dns] ||= []) << dns).flatten! |
#entrypoint(cmd) ⇒ Object
79 |
# File 'lib/dry-stack/stack.rb', line 79 def entrypoint(cmd)= @service[:entrypoint] = cmd |
#env(variables) ⇒ Object
73 |
# File 'lib/dry-stack/stack.rb', line 73 def env(variables)= @service[:environment].merge! variables |
#image(name) ⇒ Object
76 |
# File 'lib/dry-stack/stack.rb', line 76 def image(name)= @service[:image] = name |
#ingress(ing) ⇒ Object
86 |
# File 'lib/dry-stack/stack.rb', line 86 def ingress(ing) = ((@service[:ingress] ||=[]) << ing).flatten! |
#logging(opts) ⇒ Object
83 |
# File 'lib/dry-stack/stack.rb', line 83 def logging(opts) = (@service[:logging] ||= {}).merge! opts |
#network(name, opts = {}) ⇒ Object
85 |
# File 'lib/dry-stack/stack.rb', line 85 def network(name, opts = {}) = (@service[:networks][name] ||={}).merge! opts |
#ports(ports) ⇒ Object
77 |
# File 'lib/dry-stack/stack.rb', line 77 def ports(ports)= ((@service[:ports] ||= []) << ports).flatten! |
#user(user) ⇒ Object
“$UID:$GID”, “www-data:www-data”
84 |
# File 'lib/dry-stack/stack.rb', line 84 def user(user) = @service[:user] = user # "${UID}:${GID}", "www-data:www-data" |
#volume(opts) ⇒ Object
75 |
# File 'lib/dry-stack/stack.rb', line 75 def volume(opts)= ((@service[:volumes] ||= []) << opts).flatten! |