Class: Dapp::Config::Directive::Docker::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dapp/config/directive/docker/base.rb

Overview

Base

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



11
12
13
14
15
16
17
18
# File 'lib/dapp/config/directive/docker/base.rb', line 11

def initialize
  @_volume = []
  @_expose = []
  @_env = {}
  @_label = {}
  @_cmd = []
  @_onbuild = []
end

Instance Attribute Details

#_cmdObject (readonly)

Returns the value of attribute _cmd.



8
9
10
# File 'lib/dapp/config/directive/docker/base.rb', line 8

def _cmd
  @_cmd
end

#_entrypointObject (readonly)

Returns the value of attribute _entrypoint.



8
9
10
# File 'lib/dapp/config/directive/docker/base.rb', line 8

def _entrypoint
  @_entrypoint
end

#_envObject (readonly)

Returns the value of attribute _env.



8
9
10
# File 'lib/dapp/config/directive/docker/base.rb', line 8

def _env
  @_env
end

#_exposeObject (readonly)

Returns the value of attribute _expose.



8
9
10
# File 'lib/dapp/config/directive/docker/base.rb', line 8

def _expose
  @_expose
end

#_fromObject (readonly)

Returns the value of attribute _from.



8
9
10
# File 'lib/dapp/config/directive/docker/base.rb', line 8

def _from
  @_from
end

#_from_cache_versionObject (readonly)

Returns the value of attribute _from_cache_version.



9
10
11
# File 'lib/dapp/config/directive/docker/base.rb', line 9

def _from_cache_version
  @_from_cache_version
end

#_labelObject (readonly)

Returns the value of attribute _label.



8
9
10
# File 'lib/dapp/config/directive/docker/base.rb', line 8

def _label
  @_label
end

#_onbuildObject (readonly)

Returns the value of attribute _onbuild.



8
9
10
# File 'lib/dapp/config/directive/docker/base.rb', line 8

def _onbuild
  @_onbuild
end

#_userObject (readonly)

Returns the value of attribute _user.



8
9
10
# File 'lib/dapp/config/directive/docker/base.rb', line 8

def _user
  @_user
end

#_volumeObject (readonly)

Returns the value of attribute _volume.



8
9
10
# File 'lib/dapp/config/directive/docker/base.rb', line 8

def _volume
  @_volume
end

#_workdirObject (readonly)

Returns the value of attribute _workdir.



8
9
10
# File 'lib/dapp/config/directive/docker/base.rb', line 8

def _workdir
  @_workdir
end

Instance Method Details

#_change_optionsObject



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/dapp/config/directive/docker/base.rb', line 62

def _change_options
  {
    volume: _volume,
    expose: _expose,
    env: _env,
    label: _label,
    cmd: _cmd,
    onbuild: _onbuild,
    workdir: _workdir,
    user: _user,
    entrypoint: _entrypoint
  }
end

#cmd(*args) ⇒ Object



42
43
44
# File 'lib/dapp/config/directive/docker/base.rb', line 42

def cmd(*args)
  @_cmd.concat(args)
end

#entrypoint(*cmd_with_args) ⇒ Object



58
59
60
# File 'lib/dapp/config/directive/docker/base.rb', line 58

def entrypoint(*cmd_with_args)
  @_entrypoint = cmd_with_args.flatten
end

#env(**options) ⇒ Object



34
35
36
# File 'lib/dapp/config/directive/docker/base.rb', line 34

def env(**options)
  @_env.merge!(options)
end

#expose(*args) ⇒ Object



30
31
32
# File 'lib/dapp/config/directive/docker/base.rb', line 30

def expose(*args)
  @_expose.concat(args)
end

#from(image, cache_version: nil) ⇒ Object

Raises:



20
21
22
23
24
# File 'lib/dapp/config/directive/docker/base.rb', line 20

def from(image, cache_version: nil)
  raise(Error::Config, code: :docker_from_incorrect, data: { name: image }) unless image =~ /^[[^ ].]+:[[^ ].]+$/
  @_from = image
  @_from_cache_version = cache_version
end

#label(**options) ⇒ Object



38
39
40
# File 'lib/dapp/config/directive/docker/base.rb', line 38

def label(**options)
  @_label.merge!(options)
end

#onbuild(*args) ⇒ Object



46
47
48
# File 'lib/dapp/config/directive/docker/base.rb', line 46

def onbuild(*args)
  @_onbuild.concat(args)
end

#user(val) ⇒ Object



54
55
56
# File 'lib/dapp/config/directive/docker/base.rb', line 54

def user(val)
  @_user = val
end

#volume(*args) ⇒ Object



26
27
28
# File 'lib/dapp/config/directive/docker/base.rb', line 26

def volume(*args)
  @_volume.concat(args)
end

#workdir(val) ⇒ Object



50
51
52
# File 'lib/dapp/config/directive/docker/base.rb', line 50

def workdir(val)
  @_workdir = val
end