github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/pkg/model/docker_prune.go (about)

     1  package model
     2  
     3  import "time"
     4  
     5  // Prune Docker objects older than this
     6  const DockerPruneDefaultMaxAge = time.Hour * 6
     7  
     8  // How often to prune Docker images while Tilt is running
     9  const DockerPruneDefaultInterval = time.Hour
    10  
    11  // Keep the last 2 builds of an image
    12  const DockerPruneDefaultKeepRecent = 2
    13  
    14  type DockerPruneSettings struct {
    15  	Enabled    bool
    16  	MaxAge     time.Duration // "prune Docker objects older than X"
    17  	NumBuilds  int           // "prune every Y builds" (takes precedence over "prune every Z hours")
    18  	Interval   time.Duration // "prune every Z hours"
    19  	KeepRecent int           // Keep the most recent N builds of a tag.
    20  }
    21  
    22  func DefaultDockerPruneSettings() DockerPruneSettings {
    23  	// In code, disabled by default. (Note that in the Tiltfile, the default is
    24  	// that Docker Prune is ENABLED -- so in `tilt up`, if user doesn't call
    25  	// docker_prune_settings, pruning will be on by default. In `tilt down` etc.,
    26  	// pruning will always be off.
    27  	return DockerPruneSettings{Enabled: false}
    28  }