Sha256: a0867ac7dc7c40bff5cd7524ac68b9f1416157f36da814b460b6c2af483fe19d

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

class KuberKit::ImageCompiler::ImageBuilder
  include KuberKit::Import[
    "shell.docker_commands",
    "image_compiler.version_tag_builder"
  ]

  Contract KuberKit::Shell::AbstractShell, KuberKit::Core::Image, String, KeywordArgs[
    context_helper: Maybe[KuberKit::Core::ContextHelper::AbstractHelper]
  ] => Any
  def build(shell, image, build_dir, context_helper: nil)
    image.before_build_callback.call(context_helper, build_dir) if image.before_build_callback

    build_options = ["-t=#{image.registry_url}"]
    # use quite option for api mode ui, so it will only return built image id
    if KuberKit.ui_mode == :api
      build_options << "-q"
    end

    build_result = docker_commands.build(shell, build_dir, build_options)

    version_tag = version_tag_builder.get_version
    docker_commands.tag(shell, image.registry_url, version_tag)

    if image.registry.remote?
      docker_commands.tag(shell, image.registry_url, image.remote_registry_url)
      docker_commands.push(shell, image.remote_registry_url)
    end

    image.after_build_callback.call(context_helper, build_dir) if image.after_build_callback

    build_result
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
kuber_kit-1.3.9 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.3.8 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.3.7 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.1.8 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.3.6 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.1.7 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.3.5 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.3.4 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.1.6 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.3.3 lib/kuber_kit/image_compiler/image_builder.rb