Class: Kamal::Commands::Builder

Inherits:
Base
  • Object
show all
Defined in:
lib/kamal/commands/builder.rb

Defined Under Namespace

Classes: Base, Multiarch, Native

Constant Summary

Constants inherited from Base

Kamal::Commands::Base::DOCKER_HEALTH_LOG_FORMAT, Kamal::Commands::Base::DOCKER_HEALTH_STATUS_FORMAT

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#container_id_for, #initialize, #make_directory, #make_directory_for, #remove_directory, #run_over_ssh

Constructor Details

This class inherits a constructor from Kamal::Commands::Base

Instance Method Details

#ensure_local_dependencies_installedObject



46
47
48
49
50
51
52
53
54
# File 'lib/kamal/commands/builder.rb', line 46

def ensure_local_dependencies_installed
  if name.native?
    ensure_local_docker_installed
  else
    combine \
      ensure_local_docker_installed,
      ensure_local_buildx_installed
  end
end

#multiarchObject



37
38
39
# File 'lib/kamal/commands/builder.rb', line 37

def multiarch
  @multiarch ||= Kamal::Commands::Builder::Multiarch.new(config)
end

#multiarch_remoteObject



41
42
43
# File 'lib/kamal/commands/builder.rb', line 41

def multiarch_remote
  @multiarch_remote ||= Kamal::Commands::Builder::Multiarch::Remote.new(config)
end

#nameObject



6
7
8
# File 'lib/kamal/commands/builder.rb', line 6

def name
  target.class.to_s.remove("Kamal::Commands::Builder::").underscore.inquiry
end

#nativeObject



25
26
27
# File 'lib/kamal/commands/builder.rb', line 25

def native
  @native ||= Kamal::Commands::Builder::Native.new(config)
end

#native_cachedObject



29
30
31
# File 'lib/kamal/commands/builder.rb', line 29

def native_cached
  @native ||= Kamal::Commands::Builder::Native::Cached.new(config)
end

#native_remoteObject



33
34
35
# File 'lib/kamal/commands/builder.rb', line 33

def native_remote
  @native ||= Kamal::Commands::Builder::Native::Remote.new(config)
end

#targetObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kamal/commands/builder.rb', line 10

def target
  case
  when !config.builder.multiarch? && !config.builder.cached?
    native
  when !config.builder.multiarch? && config.builder.cached?
    native_cached
  when config.builder.local? && config.builder.remote?
    multiarch_remote
  when config.builder.remote?
    native_remote
  else
    multiarch
  end
end