Class: Dapp::Dimg::Config::Directive::Docker::Dimg

Inherits:
Base show all
Defined in:
lib/dapp/dimg/config/directive/docker/dimg.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#_from, #_from_cache_version

Instance Method Summary collapse

Methods inherited from Base

#from

Methods inherited from Config::Directive::Base

#clone, #encode_with

Constructor Details

#initialize(**kwargs, &blk) ⇒ Dimg

Returns a new instance of Dimg.



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

def initialize(**kwargs, &blk)
  @_volume = []
  @_expose = []
  @_env = {}
  @_label = {}
  @_cmd = []
  @_onbuild = []

  super(**kwargs, &blk)
end

Instance Attribute Details

#_cmdObject (readonly)

Returns the value of attribute _cmd.



7
8
9
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 7

def _cmd
  @_cmd
end

#_entrypointObject (readonly)

Returns the value of attribute _entrypoint.



7
8
9
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 7

def _entrypoint
  @_entrypoint
end

#_envObject (readonly)

Returns the value of attribute _env.



7
8
9
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 7

def _env
  @_env
end

#_exposeObject (readonly)

Returns the value of attribute _expose.



7
8
9
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 7

def _expose
  @_expose
end

#_labelObject (readonly)

Returns the value of attribute _label.



7
8
9
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 7

def _label
  @_label
end

#_onbuildObject (readonly)

Returns the value of attribute _onbuild.



7
8
9
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 7

def _onbuild
  @_onbuild
end

#_userObject (readonly)

Returns the value of attribute _user.



7
8
9
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 7

def _user
  @_user
end

#_volumeObject (readonly)

Returns the value of attribute _volume.



7
8
9
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 7

def _volume
  @_volume
end

#_workdirObject (readonly)

Returns the value of attribute _workdir.



7
8
9
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 7

def _workdir
  @_workdir
end

Instance Method Details

#_change_optionsObject



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 56

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

#clone_to_artifactObject



70
71
72
73
74
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 70

def clone_to_artifact
  Artifact.new(dapp: dapp).tap do |docker|
    docker.instance_variable_set('@_from', @_from)
  end
end

#cmd(*args) ⇒ Object



36
37
38
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 36

def cmd(*args)
  sub_directive_eval { @_cmd.concat(args.flatten) }
end

#entrypoint(*cmd_with_args) ⇒ Object



52
53
54
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 52

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

#env(**options) ⇒ Object



28
29
30
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 28

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

#expose(*args) ⇒ Object



24
25
26
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 24

def expose(*args)
  sub_directive_eval { @_expose.concat(args.flatten) }
end

#label(**options) ⇒ Object



32
33
34
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 32

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

#onbuild(*args) ⇒ Object



40
41
42
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 40

def onbuild(*args)
  sub_directive_eval { @_onbuild.concat(args.flatten) }
end

#user(val) ⇒ Object



48
49
50
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 48

def user(val)
  sub_directive_eval { @_user = val }
end

#volume(*args) ⇒ Object



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

def volume(*args)
  sub_directive_eval { @_volume.concat(args.flatten) }
end

#workdir(path) ⇒ Object



44
45
46
# File 'lib/dapp/dimg/config/directive/docker/dimg.rb', line 44

def workdir(path)
  sub_directive_eval { @_workdir = path_format(path) }
end