Class: BRocket::Docker

Inherits:
Configurable show all
Defined in:
lib/brocket/docker.rb

Constant Summary

Constants inherited from Configurable

Configurable::CONFIG_LINE_HEADER, Configurable::CONFIG_LINE_SEP

Instance Method Summary collapse

Instance Method Details

#buildObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/brocket/docker.rb', line 15

def build
  info("[docker build] starting")
  c = config_hash
  Dir.chdir(working_dir) do
    begin
      execute(c['BEFORE_BUILD'])
      cmd = build_build_command
      execute(cmd)
      execute(c['ON_BUILD_COMPLETE'])
    rescue
      execute(c['ON_BUILD_ERROR'])
      raise
    ensure
      execute(c['AFTER_BUILD'])
    end
  end
  success("[docker build] OK")
end

#call_after_buildObject



50
51
52
53
54
# File 'lib/brocket/docker.rb', line 50

def call_after_build
  Dir.chdir(working_dir) do
    execute(config_hash['AFTER_BUILD'])
  end
end

#call_before_buildObject



43
44
45
46
47
# File 'lib/brocket/docker.rb', line 43

def call_before_build
  Dir.chdir(working_dir) do
    execute(config_hash['BEFORE_BUILD'])
  end
end

#configObject



10
11
12
# File 'lib/brocket/docker.rb', line 10

def config
  $stdout.puts(YAML.dump(config_hash))
end

#pushObject



35
36
37
38
39
40
# File 'lib/brocket/docker.rb', line 35

def push
  info("[docker push] starting")
  cmd = build_push_command
  sh(cmd)
  success("[docker push] OK")
end