class Docker::Template::Builder::Normal

Private Class Methods

files() click to toggle source
# File lib/docker/template/builder/normal.rb, line 49
def files
  %w(
    Dockerfile
  )
end

Public Instance Methods

setup_context() click to toggle source

# File lib/docker/template/builder/normal.rb, line 19
def setup_context
  @context = @repo.tmpdir
  @copy = @context.join("copy")
  copy_dockerfile
  @copy.mkdir
end
teardown(img: false) click to toggle source
# File lib/docker/template/builder/normal.rb, line 11
def teardown(img: false)
  @img.delete "force" => true if @img && img
  @context.rmtree if @context && \
    @context.directory?
end

Private Instance Methods

cache_context() click to toggle source

# File lib/docker/template/builder/normal.rb, line 42
def cache_context
  return unless @repo.cacheable?
  return Cache.aliased_context(self) if alias?
  Cache.context(self, @context)
end
copy_dockerfile() click to toggle source

# File lib/docker/template/builder/normal.rb, line 29
def copy_dockerfile
  dockerfile = Template.project?? Template.root : @repo.root
  dockerfile = dockerfile.join("Dockerfile").read

  data = ERB::Context.new(:meta => @repo.meta)
  data = ERB.new(dockerfile).result(data._binding)
  context = @context.join("Dockerfile")
  context.write(data)
end