Sha256: 1ca803fd0321bbed5dee767529a420df8ea5dbb2026d98d2c5c184b47738cd18

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

require 'construi/config'
require 'construi/container'
require 'construi/image'

require 'docker'
require 'yaml'

module Construi

  class Runner
    def initialize(config)
      @config = config
    end

    def run(targets)
      Docker.validate_version!
      Docker.options[:read_timeout] = 60
      Docker.options[:chunk_size] = 8

      initial_image = Image.create(@config.image)

      commands = targets.map { |t| @config.target(t).commands }.flatten

      final_image = commands.reduce(IntermediateImage.seed(initial_image)) do |image, command|
        image.run(command)
      end

      final_image.delete
    end
  end

  def self.run(targets)
    Runner.new(Config.load('construi.yml')).run(targets)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
construi-0.1.0 lib/construi.rb