Class: Holodekk::Image::Instructions::Cmd

Inherits:
Builder::Instruction show all
Defined in:
lib/holodekk/image/instructions/cmd.rb

Direct Known Subclasses

Entrypoint

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Builder::Instruction

#as_json, instruction_tag, tag, #tag, #to_json

Instance Attribute Details

#cmdObject

Returns the value of attribute cmd.



7
8
9
# File 'lib/holodekk/image/instructions/cmd.rb', line 7

def cmd
  @cmd
end

Class Method Details

.build(cmd) ⇒ Object



11
12
13
# File 'lib/holodekk/image/instructions/cmd.rb', line 11

def self.build(cmd)
  new(cmd: cmd)
end

Instance Method Details

#to_dockerfileObject



15
16
17
18
19
20
21
22
23
# File 'lib/holodekk/image/instructions/cmd.rb', line 15

def to_dockerfile
  builder = Docker::Dockerfile::InstructionBuilder.new(self)
  if cmd.is_a?(Array)
    builder.value_array(*cmd.map { |c| Docker::Dockerfile::InstructionBuilder::QuotedString.new(c) })
  else
    builder.raw_value(cmd)
  end
  builder.output
end