Class: Panoramix::Plugin::DockerImage

Inherits:
DockerImageBase show all
Defined in:
lib/panoramix/plugin/docker_image.rb

Instance Attribute Summary collapse

Attributes inherited from DockerImageBase

#dst, #tag

Instance Method Summary collapse

Methods inherited from DockerImageBase

#clobber, #created?, #timestamp

Methods inherited from Base

#created?, #shell, #timestamp

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

#envObject (readonly)

Returns the value of attribute env.



9
10
11
# File 'lib/panoramix/plugin/docker_image.rb', line 9

def env
  @env
end

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

Returns:

  • (Boolean)


19
20
21
# File 'lib/panoramix/plugin/docker_image.rb', line 19

def needed? timestamps
	true
end

#psObject



35
36
37
# File 'lib/panoramix/plugin/docker_image.rb', line 35

def ps
	super ("Pulled image")
end

#run_defaultObject

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