Class: Dapp::Image::Scratch

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

Overview

Stage

Instance Attribute Summary

Attributes inherited from Docker

#from, #name, #project

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_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
24
25
# File 'lib/dapp/image/scratch.rb', line 15

def build!(**_kwargs)
  raise

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