Class: Docker::Template::Scratch

Inherits:
Builder
  • Object
show all
Defined in:
lib/docker/template/scratch.rb

Constant Summary

Constants inherited from Builder

Builder::ALIAS_SETUP, Builder::SETUP

Instance Attribute Summary collapse

Attributes inherited from Builder

#context, #img, #repo

Instance Method Summary collapse

Methods inherited from Builder

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

Constructor Details

#initialize(*args) ⇒ Scratch




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

def initialize(*args)
  super; @rootfs = Rootfs.new(
    repo
  )
end

Instance Attribute Details

#rootfsObject (readonly)

Returns the value of attribute rootfs.



10
11
12
# File 'lib/docker/template/scratch.rb', line 10

def rootfs
  @rootfs
end

Instance Method Details

#dataObject




22
23
24
25
26
27
28
# File 'lib/docker/template/scratch.rb', line 22

def data
  Template.get(:scratch, {
    :entrypoint => @repo..entry,
    :maintainer => @repo..maintainer,
    :tar_gz => @tar_gz.basename
  })
end

#teardown(img: false) ⇒ Object




32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/docker/template/scratch.rb', line 32

def teardown(img: false)
  @copy.rm_rf if @copy
  @context.rm_rf if @context
  @tar_gz.rm_rf if @tar_gz

  if @img && img
    then @img.delete({
      "force" => true
    })
  end
rescue Docker::Error::NotFoundError
  nil
end