|
|
@ -24,35 +24,14 @@ def docker_image_for_rake_compiler(platform) |
|
|
|
dockerpath = File.dirname(dockerfile) |
|
|
|
dockerpath = File.dirname(dockerfile) |
|
|
|
version = Digest::SHA1.file(dockerfile).hexdigest |
|
|
|
version = Digest::SHA1.file(dockerfile).hexdigest |
|
|
|
image_name = 'rake_' + platform + '_' + version |
|
|
|
image_name = 'rake_' + platform + '_' + version |
|
|
|
# if "DOCKERHUB_ORGANIZATION" env is set, we try to pull the pre-built |
|
|
|
ENV.fetch('DOCKERHUB_ORGANIZATION', 'grpctesting') + '/' + image_name |
|
|
|
# rake-compiler-dock image from dockerhub rather then building from scratch. |
|
|
|
|
|
|
|
if ENV.has_key?('DOCKERHUB_ORGANIZATION') |
|
|
|
|
|
|
|
image_name = ENV['DOCKERHUB_ORGANIZATION'] + '/' + image_name |
|
|
|
|
|
|
|
cmd = "docker pull #{image_name}" |
|
|
|
|
|
|
|
puts cmd |
|
|
|
|
|
|
|
system cmd |
|
|
|
|
|
|
|
raise "Failed to pull the docker image." unless $? == 0 |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
cmd = "docker build -t #{image_name} --file #{dockerfile} #{dockerpath}" |
|
|
|
|
|
|
|
puts cmd |
|
|
|
|
|
|
|
system cmd |
|
|
|
|
|
|
|
raise "Failed to build the docker image." unless $? == 0 |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
image_name |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def run_rake_compiler(platform, args) |
|
|
|
def run_rake_compiler(platform, args) |
|
|
|
require 'rake_compiler_dock' |
|
|
|
require 'rake_compiler_dock' |
|
|
|
|
|
|
|
|
|
|
|
args = 'bash -l' if args.empty? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ENV['RCD_RUBYVM'] = 'mri' |
|
|
|
ENV['RCD_RUBYVM'] = 'mri' |
|
|
|
ENV['RCD_PLATFORM'] = platform |
|
|
|
ENV['RCD_PLATFORM'] = platform |
|
|
|
ENV['RCD_IMAGE'] = docker_image_for_rake_compiler(platform) |
|
|
|
ENV['RCD_IMAGE'] = docker_image_for_rake_compiler(platform) |
|
|
|
|
|
|
|
|
|
|
|
RakeCompilerDock.sh args |
|
|
|
RakeCompilerDock.sh args |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
if __FILE__ == $0 |
|
|
|
|
|
|
|
docker_for_windows 'x86_64-linux', $*.join(' ') |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|