Class: Docker::Template::Rootfs

Inherits:
Builder
  • Object
show all
Extended by:
Forwardable::Extended
Defined in:
lib/docker/template/rootfs.rb

Constant Summary

Constants inherited from Builder

Builder::ALIAS_SETUP, Builder::SETUP

Instance Attribute Summary

Attributes inherited from Builder

#context, #img, #repo

Instance Method Summary collapse

Methods inherited from Builder

#alias?, #aliased_img, #build, #initialize, #normal?, #push, #rootfs?, #scratch?

Constructor Details

This class inherits a constructor from Docker::Template::Builder

Instance Method Details

#builder_dataObject




22
23
24
25
26
27
28
29
30
31
# File 'lib/docker/template/rootfs.rb', line 22

def builder_data
  tpl = "rootfs/#{@repo.metadata.rootfs_template}"
  erb = @repo.root.join("rootfs.erb")

  Template.get(
    erb.file?? erb : tpl, {
      :metadata => @repo.
    }
  )
end

#dataObject




14
15
16
17
18
# File 'lib/docker/template/rootfs.rb', line 14

def data
  Template.get(:rootfs, {
    :rootfs_base_img => @repo.["rootfs_base_img"]
  })
end

#simple_cleanup(dir) ⇒ Object


During a simple copy you store all the data (including rootfs) data as a single unit, this helps us clean up data that is known to be for just the rootfs image and remove it so it doesn’t impact.




39
40
41
42
43
44
45
# File 'lib/docker/template/rootfs.rb', line 39

def simple_cleanup(dir)
  file = dir.join("usr/local/bin/mkimg")

  if file.exist?
    then file.delete
  end
end

#teardown(img: true) ⇒ Object




49
50
51
52
53
# File 'lib/docker/template/rootfs.rb', line 49

def teardown(img: true)
  @context.rmtree if @context && @context.directory?
  @img.delete "force" => true if @img && img \
    rescue nil
end