Class: Panoramix::Plugin::DockerBuild
- Inherits:
-
DockerImageBase
- Object
- Base
- DockerImageBase
- Panoramix::Plugin::DockerBuild
- Defined in:
- lib/panoramix/plugin/docker_build.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#dockerfile ⇒ Object
readonly
Returns the value of attribute dockerfile.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Attributes inherited from DockerImageBase
Instance Method Summary collapse
-
#initialize(dst, dockerfile, context, host) ⇒ DockerBuild
constructor
A new instance of DockerBuild.
-
#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, dockerfile, context, host) ⇒ DockerBuild
Returns a new instance of DockerBuild.
12 13 14 15 16 17 18 |
# File 'lib/panoramix/plugin/docker_build.rb', line 12 def initialize(dst, dockerfile, context, host) super(dst, host) @dockerfile = dockerfile @context = context @env = Hash.new @env["DOCKER_HOST"] = "tcp://#{host}" if host end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
9 10 11 |
# File 'lib/panoramix/plugin/docker_build.rb', line 9 def context @context end |
#dockerfile ⇒ Object (readonly)
Returns the value of attribute dockerfile.
10 11 12 |
# File 'lib/panoramix/plugin/docker_build.rb', line 10 def dockerfile @dockerfile end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
8 9 10 |
# File 'lib/panoramix/plugin/docker_build.rb', line 8 def env @env end |
Instance Method Details
#needed?(timestamps) ⇒ Boolean
When this instance needs to be executed
21 22 23 24 |
# File 'lib/panoramix/plugin/docker_build.rb', line 21 def needed? return false if ENV['NO_BUILD'] && ENV['NO_BUILD'].split(":").any? { |image| image == @dst } return true end |
#ps ⇒ Object
31 32 33 |
# File 'lib/panoramix/plugin/docker_build.rb', line 31 def ps super ("Built image") end |
#run_default ⇒ Object
Default action for this task
27 28 29 |
# File 'lib/panoramix/plugin/docker_build.rb', line 27 def run_default shell("docker build -t #{dst} -f #{@dockerfile} #{@context}", false, @env) end |