Method: Indocker::Containers::ContainerBuilder#image

Defined in:
lib/indocker/containers/container_builder.rb

#image(name) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/indocker/containers/container_builder.rb', line 30

def image(name)
  path = Indocker.image_files[name]

  if !path
    raise ArgumentError.new("Image :#{name} was not found in bounded contexts folder")
  else
    require path
  end

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

  if !image
    Indocker.logger.error("image :#{name} was not found in configuration :#{@configuration.name}")
    exit 1
  end

  @container.set_image(image)
  self
end