Class: Tmrw::DockerImage

Inherits:
Object
  • Object
show all
Defined in:
lib/tmrw/docker_image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#tagObject (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