mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
untagged image as well
This commit is contained in:
parent
8b0ac85ad1
commit
6ba5ecc3b4
1 changed files with 16 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ resource "aws_ecr_lifecycle_policy" "my_repository_policy" {
|
||||||
|
|
||||||
policy = jsonencode({
|
policy = jsonencode({
|
||||||
rules = [
|
rules = [
|
||||||
# 1️⃣ PROTECT important environment tags forever
|
# 1️⃣ Keep important env tags forever
|
||||||
{
|
{
|
||||||
rulePriority = 1
|
rulePriority = 1
|
||||||
description = "Keep prod, main, dev images forever"
|
description = "Keep prod, main, dev images forever"
|
||||||
|
|
@ -25,9 +25,23 @@ resource "aws_ecr_lifecycle_policy" "my_repository_policy" {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
# 2️⃣ Expire everything else beyond the most recent 10 images
|
# 2️⃣ Aggressively expire untagged images
|
||||||
{
|
{
|
||||||
rulePriority = 2
|
rulePriority = 2
|
||||||
|
description = "Expire untagged images"
|
||||||
|
selection = {
|
||||||
|
tagStatus = "untagged"
|
||||||
|
countType = "imageCountMoreThan"
|
||||||
|
countNumber = 1
|
||||||
|
}
|
||||||
|
action = {
|
||||||
|
type = "expire"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
# 3️⃣ Rotate everything else
|
||||||
|
{
|
||||||
|
rulePriority = 3
|
||||||
description = "Retain only the last 10 images"
|
description = "Retain only the last 10 images"
|
||||||
selection = {
|
selection = {
|
||||||
tagStatus = "any"
|
tagStatus = "any"
|
||||||
|
|
@ -41,4 +55,3 @@ resource "aws_ecr_lifecycle_policy" "my_repository_policy" {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue