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