Class: Kubes::Docker::Strategy::Build::Base

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Includes:
Utils
Defined in:
lib/kubes/docker/strategy/build/base.rb

Direct Known Subclasses

Docker, Gcloud

Instance Method Summary collapse

Methods included from Hooks::Concern

#run_hooks

Methods included from ImageName

#args, #custom, #default, #generate_name, #git_sha, #image_name, #image_state_path, #read_image_name, #repo, #reserve_image_name, #store_image_name

Methods included from Util::Time

#pretty_time

Methods included from Util::Sh

#sh, #sh_capture

Methods included from Logging

#logger

Constructor Details

#initialize(options, name) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/kubes/docker/strategy/build/base.rb', line 6

def initialize(options, name)
  @options, @name = options, name
end

Instance Method Details

#check_dockerfile!Object



17
18
19
20
21
22
# File 'lib/kubes/docker/strategy/build/base.rb', line 17

def check_dockerfile!
  # Dockerfile is also used in args/default.rb, will have to combine if Dockerfile is made configurable
  return if File.exist?("Dockerfile")
  logger.error "ERROR: The Dockerfile does not exist. Cannot build the docker image without a Dockerfile".color(:red)
  exit 1
end

#runObject



10
11
12
13
14
15
# File 'lib/kubes/docker/strategy/build/base.rb', line 10

def run
  reserve_image_name
  check_dockerfile!
  perform
  store_image_name
end