Files
kamal/lib/mrsk/commands/prune.rb
David Heinemeier Hansson 5c93642f2a Prepare for custom pruning
2023-02-15 20:34:08 +01:00

13 lines
505 B
Ruby

require "active_support/duration"
require "active_support/core_ext/numeric/time"
class Mrsk::Commands::Prune < Mrsk::Commands::Base
def images(until_hours: 7.days.in_hours.to_i)
docker :image, :prune, "--all", "--force", "--filter", "label=service=#{config.service}", "--filter", "until=#{until_hours}h"
end
def containers(until_hours: 3.days.in_hours.to_i)
docker :container, :prune, "--force", "--filter", "label=service=#{config.service}", "--filter", "until=#{until_hours}h"
end
end