Method: Indocker::BuildContextHelper#image_url

Defined in:
lib/indocker/build_context_helper.rb

#image_url(image_sym) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/indocker/build_context_helper.rb', line 10

def image_url(image_sym)
  path = Indocker.image_files.fetch(image_sym) do
    Indocker.logger.error("image :#{image_sym} was not found in configuration :#{@configuration.name}")
    exit 1
  end

  require path

  image = @configuration.images.detect do |i|
    i.name == image_sym
  end

  if image.nil?
    raise ArgumentError.new("image :#{image_sym} was not found in configuration")
  end

  image.registry_url
end