Class: Tmrw::DockerImage
- Inherits:
-
Object
- Object
- Tmrw::DockerImage
- Defined in:
- lib/tmrw/docker_image.rb
Instance Attribute Summary collapse
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #build! ⇒ Object
-
#initialize(tag:) ⇒ DockerImage
constructor
A new instance of DockerImage.
- #push! ⇒ Object
Constructor Details
#initialize(tag:) ⇒ DockerImage
Returns a new instance of DockerImage.
5 6 7 |
# File 'lib/tmrw/docker_image.rb', line 5 def initialize(tag:) @tag = tag end |
Instance Attribute Details
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
3 4 5 |
# File 'lib/tmrw/docker_image.rb', line 3 def tag @tag end |
Instance Method Details
#build! ⇒ Object
9 10 11 12 |
# File 'lib/tmrw/docker_image.rb', line 9 def build! ok = system("docker build -t #{tag} .") raise "Failed to build docker image" unless ok end |
#push! ⇒ Object
14 15 16 17 |
# File 'lib/tmrw/docker_image.rb', line 14 def push! ok = system("docker push #{tag}") raise "Failed to push image to registry" unless ok end |