Skip to content
Permalink
Browse files

Merge pull request #1207 from jamezpolley/enable_multiple_platforms

Enable multiple platforms
  • Loading branch information...
jamezpolley committed Apr 2, 2019
2 parents a84545e + 02e6e38 commit 1b7727b3809759a499c754ca594eb119cfdf5a59
Showing with 24 additions and 6 deletions.
  1. +10 −0 app/models/scraper.rb
  2. +13 −5 lib/morph/docker_runner.rb
  3. +1 −1 lib/morph/runner.rb
@@ -266,6 +266,16 @@ def database
Morph::Database.new(data_path)
end

def platform
platform_file = "#{repo_path}/platform"
if File.exist?(platform_file)
platform = File.read(platform_file)
else
platform = "latest"
end
platform.chomp
end

# It seems silly implementing this
def self.directory_size(directory)
r = 0
@@ -27,14 +27,22 @@ def self.memory_limit
512 * 1024 * 1024
end

def self.buildstep_image
Morph::DockerUtils.get_or_pull_image(BUILDSTEP_IMAGE)
def self.buildstep_image(platform = "latest")
image = "#{BUILDSTEP_IMAGE}:#{platform}"
puts "Using image #{image}"
Morph::DockerUtils.get_or_pull_image(image)
end

def self.compile_and_start_run(
repo_path, env_variables, container_labels, max_lines = 0
)
i = buildstep_image do |c|
repo_path, env_variables, container_labels, max_lines = 0, scraper = nil
)
if scraper.nil? || scraper.platform.nil?
platform = "latest"
else
platform = scraper.platform
end

i = buildstep_image(platform) do |c|
yield(:internalout, c)
end
yield(:internalout, "Injecting configuration and compiling...\n")
@@ -106,7 +106,7 @@ def compile_and_start_run(max_lines = Runner.default_max_lines)
Morph::Runner.add_sqlite_db_to_directory(run.data_path, defaults)

Morph::DockerRunner.compile_and_start_run(
defaults, run.env_variables, docker_container_labels, max_lines
defaults, run.env_variables, docker_container_labels, max_lines, run.scraper
) do |s, c|
yield(s, c)
end

0 comments on commit 1b7727b

Please sign in to comment.
You can’t perform that action at this time.