Class: Dapp::Image::Scratch
- Defined in:
- lib/dapp/image/scratch.rb
Overview
Stage
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 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_volume, #add_volumes_from, #prepare_instructions
Methods inherited from Docker
cache, #cache_reset, cache_reset, #created_at, #id, image_config_option, image_name?, image_name_format, #pull!, #push!, #size, tag!, #tagged?, #untag!
Constructor Details
#initialize(**_kwargs) ⇒ Scratch
Returns a new instance of Scratch.
6 7 8 9 |
# File 'lib/dapp/image/scratch.rb', line 6 def initialize(**_kwargs) super @from_archives = [] end |
Instance Method Details
#add_archive(*archives) ⇒ Object
11 12 13 |
# File 'lib/dapp/image/scratch.rb', line 11 def add_archive(*archives) @from_archives.concat(archives.flatten) end |
#build!(**_kwargs) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/dapp/image/scratch.rb', line 15 def build!(**_kwargs) build_from_command = if from_archives.empty? "#{project.tar_bin} c --files-from /dev/null" else "#{project.cat_bin} #{from_archives.join(' ')}" end #FIXME: do not use docker import from system-shellout @built_id = project.system_shellout!("#{build_from_command} | docker import #{prepared_change} - ").stdout.strip end |