Class: Buildizer::Image
- Inherits:
-
Object
- Object
- Buildizer::Image
- Defined in:
- lib/buildizer/image.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#instructions ⇒ Object
readonly
Returns the value of attribute instructions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #build_path ⇒ Object
- #dockerfile_dump ⇒ Object
- #dockerfile_name ⇒ Object
- #dockerfile_path ⇒ Object
- #dockerfile_write! ⇒ Object
- #extra_path ⇒ Object
-
#initialize(name, target, from: nil) ⇒ Image
constructor
A new instance of Image.
- #instruction(instruction, cmd) ⇒ Object
Constructor Details
#initialize(name, target, from: nil) ⇒ Image
Returns a new instance of Image.
9 10 11 12 13 14 15 16 17 |
# File 'lib/buildizer/image.rb', line 9 def initialize(name, target, from: nil) @name = name @target = target @instructions = [] @from = from instruction :FROM, from if from end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
7 8 9 |
# File 'lib/buildizer/image.rb', line 7 def from @from end |
#instructions ⇒ Object (readonly)
Returns the value of attribute instructions.
6 7 8 |
# File 'lib/buildizer/image.rb', line 6 def instructions @instructions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/buildizer/image.rb', line 3 def name @name end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
4 5 6 |
# File 'lib/buildizer/image.rb', line 4 def target @target end |
Instance Method Details
#build_path ⇒ Object
23 24 25 |
# File 'lib/buildizer/image.rb', line 23 def build_path target.image_build_path end |
#dockerfile_dump ⇒ Object
39 40 41 |
# File 'lib/buildizer/image.rb', line 39 def dockerfile_dump [instructions, nil].join("\n") end |
#dockerfile_name ⇒ Object
31 32 33 |
# File 'lib/buildizer/image.rb', line 31 def dockerfile_name "#{name}.dockerfile" end |
#dockerfile_path ⇒ Object
35 36 37 |
# File 'lib/buildizer/image.rb', line 35 def dockerfile_path target.image_work_path.join(dockerfile_name) end |
#dockerfile_write! ⇒ Object
43 44 45 |
# File 'lib/buildizer/image.rb', line 43 def dockerfile_write! dockerfile_path.write! dockerfile_dump end |
#extra_path ⇒ Object
27 28 29 |
# File 'lib/buildizer/image.rb', line 27 def extra_path target.image_extra_path end |
#instruction(instruction, cmd) ⇒ Object
19 20 21 |
# File 'lib/buildizer/image.rb', line 19 def instruction(instruction, cmd) instructions << [instruction.to_s.upcase, cmd].join(' ') end |