Class: Kuby::Plugins::RailsApp::AssetsImage

Inherits:
Docker::Image show all
Defined in:
lib/kuby/plugins/rails_app/assets_image.rb

Instance Attribute Summary collapse

Attributes inherited from Docker::Image

#alias_tags, #credentials, #identifier, #image_url, #main_tag, #registry_index_url

Instance Method Summary collapse

Methods inherited from Docker::Image

#docker_cli, #dockerfile, #image_host, #image_hostname, #image_repo, #image_uri, #registry_index_host, #registry_index_hostname, #registry_index_uri, #tags

Constructor Details

#initialize(base_image, dockerfile, registry_index_url = nil, main_tag = nil, alias_tags = []) ⇒ AssetsImage

Returns a new instance of AssetsImage.



7
8
9
10
11
# File 'lib/kuby/plugins/rails_app/assets_image.rb', line 7

def initialize(base_image, dockerfile, registry_index_url = nil, main_tag = nil, alias_tags = [])
  super(dockerfile, base_image.image_url, base_image.credentials, registry_index_url, main_tag, alias_tags)
  @base_image = base_image
  @identifier = "assets"
end

Instance Attribute Details

#base_imageObject (readonly)

Returns the value of attribute base_image.



5
6
7
# File 'lib/kuby/plugins/rails_app/assets_image.rb', line 5

def base_image
  @base_image
end

Instance Method Details

#build(build_args = {}, docker_args = [], context: nil, cache_from: nil) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/kuby/plugins/rails_app/assets_image.rb', line 32

def build(build_args = {}, docker_args = [], context: nil, cache_from: nil)
  docker_cli.build(
    self,
    build_args: build_args,
    docker_args: docker_args,
    context: context,
    cache_from: cache_from
  )
end

#current_versionObject



20
21
22
23
24
# File 'lib/kuby/plugins/rails_app/assets_image.rb', line 20

def current_version
  duplicate_with_annotated_tags(
    base_image.current_version
  )
end

#new_versionObject



13
14
15
16
17
18
# File 'lib/kuby/plugins/rails_app/assets_image.rb', line 13

def new_version
  # asset images track the app image
  duplicate_with_annotated_tags(
    base_image.new_version.exists? ? base_image.new_version : base_image.current_version
  )
end

#previous_versionObject



26
27
28
29
30
# File 'lib/kuby/plugins/rails_app/assets_image.rb', line 26

def previous_version
  duplicate_with_annotated_tags(
    base_image.previous_version
  )
end

#pull(tag) ⇒ Object



46
47
48
# File 'lib/kuby/plugins/rails_app/assets_image.rb', line 46

def pull(tag)
  docker_cli.pull(image_url, tag)
end

#push(tag) ⇒ Object



42
43
44
# File 'lib/kuby/plugins/rails_app/assets_image.rb', line 42

def push(tag)
  docker_cli.push(image_url, tag)
end