|
| 1 | +variable "OWNER" { |
| 2 | + default = "visualon" |
| 3 | +} |
| 4 | +variable "FILE" { |
| 5 | + default = "renovate" |
| 6 | +} |
| 7 | +variable "TAG" { |
| 8 | + default = "latest" |
| 9 | +} |
| 10 | +variable "VERSION" { |
| 11 | + default = "" |
| 12 | +} |
| 13 | + |
| 14 | +group "default" { |
| 15 | + targets = ["build_ghcr", "build_docker"] |
| 16 | +} |
| 17 | + |
| 18 | +group "build" { |
| 19 | + targets = ["build_ghcr", "build_docker", "push_ghcr"] |
| 20 | +} |
| 21 | + |
| 22 | +group "push" { |
| 23 | + targets = ["push_ghcr"] |
| 24 | +} |
| 25 | + |
| 26 | +group "test" { |
| 27 | + targets = ["build_docker"] |
| 28 | +} |
| 29 | + |
| 30 | +target "settings" { |
| 31 | + inherits = ["settings"] |
| 32 | + cache-from = [ |
| 33 | + "type=registry,ref=ghcr.io/${OWNER}/cache:${FILE}", |
| 34 | + "type=registry,ref=ghcr.io/${OWNER}/cache:${FILE}-${TAG}", |
| 35 | + "type=registry,ref=ghcr.io/${OWNER}/cache:${FILE}-${VERSION}", |
| 36 | + ] |
| 37 | +} |
| 38 | + |
| 39 | +target "build_ghcr" { |
| 40 | + inherits = ["settings"] |
| 41 | + output = ["type=registry"] |
| 42 | + tags = [ |
| 43 | + "ghcr.io/${OWNER}/cache:${FILE}-${TAG}", |
| 44 | + notequal("", VERSION) ? "ghcr.io/${OWNER}/cache:${FILE}-${VERSION}" : "", |
| 45 | + ] |
| 46 | + cache-to = ["type=inline,mode=max"] |
| 47 | +} |
| 48 | + |
| 49 | +target "build_docker" { |
| 50 | + inherits = ["settings"] |
| 51 | + output = ["type=docker"] |
| 52 | + tags = [ |
| 53 | + "ghcr.io/${OWNER}/${FILE}:${TAG}", |
| 54 | + notequal("", VERSION) ? "ghcr.io/${OWNER}/${FILE}:${VERSION}" : "", |
| 55 | + ] |
| 56 | +} |
| 57 | + |
| 58 | +target "push_ghcr" { |
| 59 | + inherits = ["settings"] |
| 60 | + output = ["type=registry"] |
| 61 | + tags = [ |
| 62 | + "ghcr.io/${OWNER}/${FILE}:${TAG}", |
| 63 | + notequal("", VERSION) ? "ghcr.io/${OWNER}/${FILE}:${VERSION}" : "", |
| 64 | + ] |
| 65 | +} |
0 commit comments