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

Inherits:
Stage show all
Defined in:
lib/dapp/dimg/image/scratch.rb

Instance Attribute Summary

Attributes inherited from Docker

#dapp, #from, #name

Instance Method Summary collapse

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!, #tagged?, #untag!

Constructor Details

#initialize(**_kwargs) ⇒ Scratch

Returns a new instance of Scratch.



5
6
7
8
# File 'lib/dapp/dimg/image/scratch.rb', line 5

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

Instance Method Details

#add_archive(*archives) ⇒ Object



10
11
12
# File 'lib/dapp/dimg/image/scratch.rb', line 10

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

#build!(**_kwargs) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/dapp/dimg/image/scratch.rb', line 14

def build!(**_kwargs)
  raise

  # FIXME: system-shellout rejected
  # build_from_command = if from_archives.empty?
  #                        "#{dapp.tar_bin} c --files-from /dev/null"
  #                      else
  #                        "#{dapp.cat_bin} #{from_archives.join(' ')}"
  #                      end
  # @built_id = dapp.system_shellout!("#{build_from_command} | docker import #{prepared_change} - ").stdout.strip
end