Split out proper Prune command
This commit is contained in:
@@ -21,5 +21,6 @@ module Mrsk::Commands
|
||||
end
|
||||
|
||||
require "mrsk/commands/app"
|
||||
require "mrsk/commands/prune"
|
||||
require "mrsk/commands/traefik"
|
||||
require "mrsk/commands/registry"
|
||||
|
||||
13
lib/mrsk/commands/prune.rb
Normal file
13
lib/mrsk/commands/prune.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class Mrsk::Commands::Prune < Mrsk::Commands::Base
|
||||
PRUNE_IMAGES_AFTER = 30.days.in_hours.to_i
|
||||
PRUNE_CONTAINERS_AFTER = 3.days.in_hours.to_i
|
||||
|
||||
def images
|
||||
docker :image, :prune, "-f", "--filter", "until=#{PRUNE_IMAGES_AFTER}h"
|
||||
end
|
||||
|
||||
def containers
|
||||
docker :image, :prune, "-f", "--filter", "until=#{PRUNE_IMAGES_AFTER}h"
|
||||
docker :container, :prune, "-f", "--filter", "label=service=#{config.service}", "--filter", "'until=#{PRUNE_CONTAINERS_AFTER}h'"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user