Class: Dry::ServiceFunction

Inherits:
Object
  • Object
show all
Defined in:
lib/dry-stack/stack.rb

Instance Method Summary collapse

Constructor Details

#initialize(service) ⇒ ServiceFunction

Returns a new instance of ServiceFunction.



47
# File 'lib/dry-stack/stack.rb', line 47

def initialize(service, &); @service = service; instance_exec(&) end

Instance Method Details

#command(cmd) ⇒ Object



52
# File 'lib/dry-stack/stack.rb', line 52

def command(cmd)= @service[:command] = cmd

#config(name, opts) ⇒ Object



55
# File 'lib/dry-stack/stack.rb', line 55

def config(name, opts)= (@service[:configs] ||= []) << {source: name.to_s }.merge(opts)

#deploy_label(str) ⇒ Object



54
# File 'lib/dry-stack/stack.rb', line 54

def deploy_label(str)= @service[:deploy][:labels] << str

#entrypoint(cmd) ⇒ Object



53
# File 'lib/dry-stack/stack.rb', line 53

def entrypoint(cmd)= @service[:entrypoint] = cmd

#env(variables) ⇒ Object



48
# File 'lib/dry-stack/stack.rb', line 48

def env(variables)= @service[:environment].merge! variables

#image(name) ⇒ Object



50
# File 'lib/dry-stack/stack.rb', line 50

def image(name)= @service[:image] = name

#logging(opts) ⇒ Object



56
# File 'lib/dry-stack/stack.rb', line 56

def logging(opts) = (@service[:logging] ||= {}).merge!  opts

#network(names) ⇒ Object



58
# File 'lib/dry-stack/stack.rb', line 58

def network(names) = (@service[:networks] ||= []) << names

#ports(ports) ⇒ Object



51
# File 'lib/dry-stack/stack.rb', line 51

def ports(ports)= ((@service[:ports] ||= []) << ports).flatten!

#user(user) ⇒ Object

“$UID:$GID”, “www-data:www-data”



57
# File 'lib/dry-stack/stack.rb', line 57

def user(user) = @service[:user] = user #  "${UID}:${GID}", "www-data:www-data"

#volume(opts) ⇒ Object



49
# File 'lib/dry-stack/stack.rb', line 49

def volume(opts)= ((@service[:volumes] ||= []) << opts).flatten!