Class: Dapp::Dimg::Image::Scratch

Inherits:
Stage
  • Object
show all
Includes:
Helper::Tar
Defined in:
lib/dapp/dimg/image/scratch.rb

Instance Attribute Summary

Attributes inherited from Stage

#dapp, #from, #name

Instance Method Summary collapse

Methods included from Helper::Tar

#tar_gz_read, #tar_read, #tar_write

Methods inherited from Stage

#built?, #built_id, #built_image_inspect, #built_image_inspect!, #created_at, #export!, #get_ruby2go_short_state_hash, #get_ruby2go_state_hash, #id, image_by_name, #image_inspect, image_name?, image_name_format, image_reset, images, #import!, #introspect!, #labels, load!, #pull!, #push!, #reset_image_inspect, ruby2go_command, #ruby2go_command, #ruby2go_command_options, #ruby2go_image_build_options, #ruby2go_image_option, #ruby2go_short_image_option, save!, #save_in_cache!, #set_ruby2go_state_hash, #size, #tag!, tag?, tag_format, #tagged?, #untag!

Methods included from Argument

#add_change_cmd, #add_change_entrypoint, #add_change_env, #add_change_expose, #add_change_label, #add_change_onbuild, #add_change_user, #add_change_volume, #add_change_workdir, #add_command, #add_env, #add_service_change_label, #add_service_command, #add_volume, #add_volumes_from, #prepare_instructions

Constructor Details

#initialize(**_kwargs) ⇒ Scratch

Returns a new instance of Scratch.



7
8
9
10
# File 'lib/dapp/dimg/image/scratch.rb', line 7

def initialize(**_kwargs)
  super
  @from_archives = []
end

Instance Method Details

#add_archive(*archives) ⇒ Object



12
13
14
# File 'lib/dapp/dimg/image/scratch.rb', line 12

def add_archive(*archives)
  @from_archives.concat(archives.flatten)
end

#build!(**_kwargs) ⇒ Object



16
17
18
19
20
# File 'lib/dapp/dimg/image/scratch.rb', line 16

def build!(**_kwargs)
  @built_id = dapp.shellout!("docker import #{prepared_change} #{archive}").stdout.strip
ensure
  FileUtils.rm_rf(tmp_path)
end