class Indocker::Launchers::ImagesCompiler

Public Class Methods

new(logger) click to toggle source
# File lib/indocker/launchers/images_compiler.rb, line 2
def initialize(logger)
  @logger = logger
end

Public Instance Methods

compile(configuration:, image_list:, skip_dependent:) click to toggle source
# File lib/indocker/launchers/images_compiler.rb, line 6
def compile(configuration:, image_list:, skip_dependent:)
  preload_images(configuration, image_list)

  build_context = Indocker::BuildContext.new(
    configuration: configuration,
    logger: @logger,
    global_logger: Indocker.global_logger
  )

  image_compiler = Indocker::Images::ImageCompiler.new

  image_list.each do |image_name|
    image = Indocker.configuration.images.detect do |i|
      i.name == image_name
    end

    image_compiler.compile(build_context, image, skip_dependent)
  end
end

Private Instance Methods

preload_images(configuration, image_list) click to toggle source
# File lib/indocker/launchers/images_compiler.rb, line 28
def preload_images(configuration, image_list)
  image_list.each do |image_name|
    image_path = Indocker.image_files.fetch(image_name) do
      @logger.error("image not found :#{image_name} in configuration :#{configuration.name}")
      exit 1
    end

    require image_path
  end
end