Sha256: 687f7d1c1b133eef8da6ebd2551e48f43489478b72742ac3f40edcf77b380b84

Contents?: true

Size: 1.14 KB

Versions: 63

Compression:

Stored size: 1.14 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::BaseHelper::CONTRACT]
  ] => 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

63 entries across 63 versions & 1 rubygems

Version Path
kuber_kit-1.3.2 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.1.5 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.3.1 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.3.0 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.1.4 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.2.7 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.2.6 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.2.5 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.2.4 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.2.2 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.1.2 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.2.1 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.2.0 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.1.1 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.0.1 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-1.0.0 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-0.9.9 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-0.9.8 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-0.9.7 lib/kuber_kit/image_compiler/image_builder.rb
kuber_kit-0.9.6 lib/kuber_kit/image_compiler/image_builder.rb