Class: Holodekk::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/holodekk/image.rb,
lib/holodekk/image/instructions/add.rb,
lib/holodekk/image/instructions/arg.rb,
lib/holodekk/image/instructions/cmd.rb,
lib/holodekk/image/instructions/env.rb,
lib/holodekk/image/instructions/run.rb,
lib/holodekk/image/instructions/copy.rb,
lib/holodekk/image/instructions/from.rb,
lib/holodekk/image/instructions/user.rb,
lib/holodekk/image/instructions/label.rb,
lib/holodekk/image/instructions/shell.rb,
lib/holodekk/image/instructions/expose.rb,
lib/holodekk/image/instructions/volume.rb,
lib/holodekk/image/instructions/onbuild.rb,
lib/holodekk/image/instructions/workdir.rb,
lib/holodekk/image/instructions/entrypoint.rb,
lib/holodekk/image/instructions/stopsignal.rb,
lib/holodekk/image/instructions/healthcheck.rb,
lib/holodekk/image/instructions/run/options/with_ssh_mount.rb,
lib/holodekk/image/instructions/run/options/with_bind_mount.rb,
lib/holodekk/image/instructions/run/options/with_cache_mount.rb,
lib/holodekk/image/instructions/run/options/with_tmpfs_mount.rb,
lib/holodekk/image/instructions/run/options/with_secret_mount.rb

Defined Under Namespace

Modules: Instructions Classes: Builder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Image

Returns a new instance of Image.



25
26
27
# File 'lib/holodekk/image.rb', line 25

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



23
24
25
# File 'lib/holodekk/image.rb', line 23

def name
  @name
end

Class Method Details

.build(name, &block) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/holodekk/image.rb', line 37

def self.build(name, &block)
  image = new(name)
  if block_given?
    builder = Image::Builder.new(image.instructions)
    builder.instance_eval(&block)
  end
  image
end

Instance Method Details

#instructionsObject



29
30
31
# File 'lib/holodekk/image.rb', line 29

def instructions
  @instructions ||= []
end

#to_dockerfileObject



33
34
35
# File 'lib/holodekk/image.rb', line 33

def to_dockerfile
  instructions.map(&:to_dockerfile).join("\n\n")
end