Class: Panoramix::Plugin::DockerImage
- Inherits:
-
DockerImageBase
- Object
- Base
- DockerImageBase
- Panoramix::Plugin::DockerImage
- Defined in:
- lib/panoramix/plugin/docker_image.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
Attributes inherited from DockerImageBase
Instance Method Summary collapse
-
#initialize(dst, src, host) ⇒ DockerImage
constructor
A new instance of DockerImage.
-
#needed?(timestamps) ⇒ Boolean
When this instance needs to be executed.
- #ps ⇒ Object
-
#run_default ⇒ Object
Default action for this task.
Methods inherited from DockerImageBase
#clobber, #created?, #timestamp
Methods inherited from Base
Constructor Details
#initialize(dst, src, host) ⇒ DockerImage
Returns a new instance of DockerImage.
11 12 13 14 15 16 |
# File 'lib/panoramix/plugin/docker_image.rb', line 11 def initialize(dst, src, host) super(dst, host) @src = src @env = Hash.new @env["DOCKER_HOST"] = "tcp://#{host}" if host end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
9 10 11 |
# File 'lib/panoramix/plugin/docker_image.rb', line 9 def env @env end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
8 9 10 |
# File 'lib/panoramix/plugin/docker_image.rb', line 8 def src @src end |
Instance Method Details
#needed?(timestamps) ⇒ Boolean
When this instance needs to be executed
19 20 21 |
# File 'lib/panoramix/plugin/docker_image.rb', line 19 def needed? true end |
#ps ⇒ Object
35 36 37 |
# File 'lib/panoramix/plugin/docker_image.rb', line 35 def ps super ("Pulled image") end |
#run_default ⇒ Object
Default action for this task
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/panoramix/plugin/docker_image.rb', line 24 def run_default shell("docker pull #{@src}", false, @env) unless ENV["NO_PULL"] # Tag image with required tag shell("docker tag #{@src} #{@dst}", false, @env) # Remove origin image # shell("docker rmi #{@src}", false, @env) # It fails when the base image is in use. end |