forked from c-buisson/chef-server
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathRakefile.rb
More file actions
26 lines (22 loc) · 669 Bytes
/
Rakefile.rb
File metadata and controls
26 lines (22 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
namespace 'chef_server' do
task :build do
# read image name from file
image_name = String.new()
File.open('./scripts/image_metadata.txt','r')do |f|
# file is opened
file_contents = f.readlines
file_contents.each do |line|
if line.start_with?("image_name")
no_space_line = line.gsub(/\s+/, "")
image_name = no_space_line.gsub(/image_name=/, "")
end
end
end
begin
Rake.sh("docker build -t #{image_name} .")
rescue Exception => ex
# catch any Exception (including StandardError)
fail "Failed to build docker image, error: #{ex.message}"
end
end
end