Class: Nvoi::Cli::Deploy::Steps::BuildImage

Inherits:
Object
  • Object
show all
Defined in:
lib/nvoi/cli/deploy/steps/build_image.rb

Overview

BuildImage handles Docker image building and pushing to registry

Instance Method Summary collapse

Constructor Details

#initialize(config, log) ⇒ BuildImage

Returns a new instance of BuildImage.



9
10
11
12
# File 'lib/nvoi/cli/deploy/steps/build_image.rb', line 9

def initialize(config, log)
  @config = config
  @log = log
end

Instance Method Details

#run(working_dir, image_tag) ⇒ Object

Build locally and push to registry via SSH tunnel Returns the registry tag for use in k8s deployments



16
17
18
19
20
21
22
23
24
# File 'lib/nvoi/cli/deploy/steps/build_image.rb', line 16

def run(working_dir, image_tag)
  @log.info "Building Docker image: %s", image_tag

  build_image(working_dir, image_tag)
  registry_tag = push_to_registry(image_tag)

  @log.success "Image built and pushed: %s", registry_tag
  registry_tag
end