panoramix 0.7.19 → 0.7.20
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/panoramix/plugin/docker_build.rb +10 -6
- metadata +2 -2
@@ -5,12 +5,14 @@ module Panoramix
|
|
5
5
|
|
6
6
|
class DockerBuild < DockerImageBase
|
7
7
|
|
8
|
-
attr_reader :src
|
9
8
|
attr_reader :env
|
9
|
+
attr_reader :context
|
10
|
+
attr_reader :dockerfile
|
10
11
|
|
11
|
-
def initialize(dst,
|
12
|
+
def initialize(dst, dockerfile, context, host)
|
12
13
|
super(dst, host)
|
13
|
-
@
|
14
|
+
@dockerfile = dockerfile
|
15
|
+
@context = context
|
14
16
|
@env = Hash.new
|
15
17
|
@env["DOCKER_HOST"] = "tcp://#{host}" if host
|
16
18
|
end
|
@@ -23,7 +25,7 @@ module Panoramix
|
|
23
25
|
|
24
26
|
# Default action for this task
|
25
27
|
def run_default
|
26
|
-
shell("docker build -t #{dst} #{
|
28
|
+
shell("docker build -t #{dst} -f #{@dockerfile} #{@context}", false, @env)
|
27
29
|
end
|
28
30
|
|
29
31
|
def ps
|
@@ -36,7 +38,6 @@ module Panoramix
|
|
36
38
|
end
|
37
39
|
|
38
40
|
def docker_image(args, block=nil)
|
39
|
-
|
40
41
|
puts "Warning using obsolete docker_image
|
41
42
|
\t => #{"docker_image".bold} <image_name> => {dockerfile: <path_dockerfile>}.\n\tchange to:
|
42
43
|
\t => #{"docker_build".bold} <image_name> => {dockerfile: <path_dockerfile>}".red
|
@@ -59,6 +60,9 @@ def docker_build(args, &block)
|
|
59
60
|
raise message
|
60
61
|
end
|
61
62
|
|
63
|
+
# Get context if given
|
64
|
+
context = config.fetch(:context, ".")
|
65
|
+
|
62
66
|
# Select the host
|
63
67
|
host = config.fetch(:host, nil)
|
64
68
|
|
@@ -69,7 +73,7 @@ def docker_build(args, &block)
|
|
69
73
|
prerequisites = prerequisites.push(dockerfile) unless dockerfile.nil?
|
70
74
|
prerequisites.flatten!
|
71
75
|
|
72
|
-
instance = Panoramix::Plugin::DockerBuild.new(name, dockerfile, host)
|
76
|
+
instance = Panoramix::Plugin::DockerBuild.new(name, dockerfile, context, host)
|
73
77
|
|
74
78
|
descriptions = I18n.t('docker_build')
|
75
79
|
descriptions = Hash.new if descriptions.class != Hash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panoramix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-05-
|
12
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|