Class: Mrsk::Commands::Builder

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

Defined Under Namespace

Classes: Base, Multiarch, Native

Constant Summary

Constants inherited from Base

Mrsk::Commands::Base::DOCKER_HEALTH_LOG_FORMAT, Mrsk::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, #run_over_ssh

Constructor Details

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

Instance Method Details

#ensure_local_dependencies_installedObject



44
45
46
47
48
49
50
51
52
# File 'lib/mrsk/commands/builder.rb', line 44

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



35
36
37
# File 'lib/mrsk/commands/builder.rb', line 35

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

#multiarch_remoteObject



39
40
41
# File 'lib/mrsk/commands/builder.rb', line 39

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

#nameObject



4
5
6
# File 'lib/mrsk/commands/builder.rb', line 4

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

#nativeObject



23
24
25
# File 'lib/mrsk/commands/builder.rb', line 23

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

#native_cachedObject



27
28
29
# File 'lib/mrsk/commands/builder.rb', line 27

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

#native_remoteObject



31
32
33
# File 'lib/mrsk/commands/builder.rb', line 31

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

#targetObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mrsk/commands/builder.rb', line 8

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