Class: Command::BuildImage

Inherits:
Base
  • Object
show all
Defined in:
lib/command/build_image.rb

Constant Summary collapse

NAME =
"build-image"
OPTIONS =
[
  app_option(required: true),
  commit_option
].freeze
DESCRIPTION =
"Builds and pushes the image to Control Plane"
LONG_DESCRIPTION =
"- Builds and pushes the image to Control Plane\n- Automatically assigns image numbers, e.g., `app:1`, `app:2`, etc.\n- Uses `.controlplane/Dockerfile`\n"

Constants inherited from Base

Command::Base::DEFAULT_ARGS, Command::Base::EXAMPLES, Command::Base::HIDE, Command::Base::NO_IMAGE_AVAILABLE, Command::Base::REQUIRES_ARGS, Command::Base::USAGE

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

all_commands, all_options, all_options_by_key_name, app_option, #args_join, commit_option, #cp, #ensure_workload_deleted, image_option, #initialize, #latest_image, #latest_image_from, #latest_image_next, org_option, #perform, #progress, skip_confirm_option, #step, upstream_token_option, use_local_token_option, version_option, #wait_for, #wait_for_replica, #wait_for_workload, workload_option

Constructor Details

This class inherits a constructor from Command::Base

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/command/build_image.rb', line 17

def call
  ensure_docker_running!

  dockerfile = config.current[:dockerfile] || "Dockerfile"
  dockerfile = "#{config.app_cpln_dir}/#{dockerfile}"

  progress.puts("Building image from Dockerfile '#{dockerfile}'...\n\n")

  cp.image_build(latest_image_next, dockerfile: dockerfile)
end