Class: Kamal::Cli::Prune

Inherits:
Base
  • Object
show all
Defined in:
lib/kamal/cli/prune.rb

Instance Method Summary collapse

Methods inherited from Base

dynamic_command_class, exit_on_failure?, #initialize

Constructor Details

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

Instance Method Details

#allObject



3
4
5
6
7
8
# File 'lib/kamal/cli/prune.rb', line 3

def all
  with_lock do
    containers
    images
  end
end

#containersObject



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/kamal/cli/prune.rb', line 23

def containers
  retain = options.fetch(:retain, KAMAL.config.retain_containers)
  raise "retain must be at least 1" if retain < 1

  with_lock do
    on(KAMAL.hosts) do
      execute *KAMAL.auditor.record("Pruned containers"), verbosity: :debug
      execute *KAMAL.prune.app_containers(retain: retain)
    end
  end
end

#imagesObject



11
12
13
14
15
16
17
18
19
# File 'lib/kamal/cli/prune.rb', line 11

def images
  with_lock do
    on(KAMAL.hosts) do
      execute *KAMAL.auditor.record("Pruned images"), verbosity: :debug
      execute *KAMAL.prune.dangling_images
      execute *KAMAL.prune.tagged_images
    end
  end
end