Class: Dapp::Dimg::Image::Scratch
- Includes:
- Helper::Tar
- Defined in:
- lib/dapp/dimg/image/scratch.rb
Instance Attribute Summary
Attributes inherited from Docker
Instance Method Summary collapse
- #add_archive(*archives) ⇒ Object
- #build!(**_kwargs) ⇒ Object
-
#initialize(**_kwargs) ⇒ Scratch
constructor
A new instance of Scratch.
Methods included from Helper::Tar
#tar_gz_read, #tar_read, #tar_write
Methods inherited from Stage
#built?, #built_id, #export!, #import!, #labels, #save_in_cache!, #tag!
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
Methods inherited from Docker
cache, cache_reset, #cache_reset, #created_at, #id, image_by_name, image_config_option, image_name?, image_name_format, load!, #pull!, #push!, save!, #size, tag!, tag?, tag_format, #tagged?, #untag!
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 |