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

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

Direct Known Subclasses

Artifact, Dimg

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#clone_to_artifact

Methods inherited from Config::Directive::Base

#clone, #encode_with, #initialize

Constructor Details

This class inherits a constructor from Dapp::Config::Directive::Base

Instance Attribute Details

#_fromObject (readonly)

Returns the value of attribute _from.



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

def _from
  @_from
end

#_from_cache_versionObject (readonly)

Returns the value of attribute _from_cache_version.



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

def _from_cache_version
  @_from_cache_version
end

Instance Method Details

#from(image, cache_version: nil) ⇒ Object



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

def from(image, cache_version: nil)
  sub_directive_eval do
    image = image.to_s
    raise(::Dapp::Error::Config, code: :docker_from_incorrect, data: { name: image }) unless ::Dapp::Dimg::Image::Stage.image_name?(image)
    @_from = image.include?(':') ? image : [image, 'latest'].join(':')
    @_from_cache_version = cache_version
  end
end