|
| 1 | +variable "environment" { |
| 2 | + default = "testing" |
| 3 | + validation { |
| 4 | + condition = contains(["testing", "production"], environment) |
| 5 | + error_message = "environment must be either testing or production" |
| 6 | + } |
| 7 | +} |
| 8 | + |
| 9 | +variable "registry" { |
| 10 | + default = "localhost:5000" |
| 11 | +} |
| 12 | + |
| 13 | +fullname = ( environment == "testing") ? "${registry}/postgresql-testing" : "{registry}/postgresql" |
| 14 | +now = timestamp() |
| 15 | + |
| 16 | +target "postgresql" { |
| 17 | + matrix = { |
| 18 | + tgt = ["minimal", "standard"] |
| 19 | + pgVersion = [ |
| 20 | +// "13.18", |
| 21 | +// "14.15", |
| 22 | +// "15.10", |
| 23 | + "16.6", |
| 24 | + "17.2" |
| 25 | + ] |
| 26 | + distroVersion = [ |
| 27 | + // "bookworm-20241223-slim", |
| 28 | + "bullseye-20241223-slim" |
| 29 | + ] |
| 30 | + } |
| 31 | + dockerfile = "Dockerfile" |
| 32 | + name = "postgresql-${index(split(".",pgVersion),0)}-${index(split("-",distroVersion),0)}-${tgt}" |
| 33 | + tags = [ |
| 34 | + "${fullname}:${index(split(".",pgVersion),0)}-${index(split("-",distroVersion),0)}-${tgt}", |
| 35 | + "${fullname}:${pgVersion}-${index(split("-",distroVersion),0)}-${tgt}", |
| 36 | + "${fullname}:${pgVersion}-${formatdate("YYYYMMDDhhmm", now)}-${index(split("-",distroVersion),0)}-${tgt}" |
| 37 | + ] |
| 38 | + context = "." |
| 39 | + target = "${tgt}" |
| 40 | + args = { |
| 41 | + PG_VERSION = "${pgVersion}" |
| 42 | + DISTRO = "debian:${distroVersion}" |
| 43 | + BUILDTIME = "${now}" |
| 44 | + REVISION = "${formatdate("YYYYMMDDhhmm", now)}" |
| 45 | + } |
| 46 | + attest = [ |
| 47 | + "type=provenance,mode=max", |
| 48 | + "type=sbom" |
| 49 | + ] |
| 50 | + annotations = [ |
| 51 | + "index,manifest:org.opencontainers.image.created=${now}", |
| 52 | + "index,manifest:org.opencontainers.image.url=https://github.com/cloudnative-pg/postgres-containers", |
| 53 | + "index,manifest:org.opencontainers.image.source=https://github.com/cloudnative-pg/postgres-containers", |
| 54 | + "index,manifest:org.opencontainers.image.version=${pgVersion}", |
| 55 | + "index,manifest:org.opencontainers.image.revision=${formatdate("YYYYMMDDhhmm", now)}", |
| 56 | + "index,manifest:org.opencontainers.image.vendor=The CloudNativePG Contributors", |
| 57 | + "index,manifest:org.opencontainers.image.title=CloudNativePG PostgreSQL ${pgVersion} minimal", |
| 58 | + "index,manifest:org.opencontainers.image.description=A minimal PostgreSQL ${pgVersion} container image", |
| 59 | + "index,manifest:org.opencontainers.image.documentation=https://github.com/cloudnative-pg/postgres-containers", |
| 60 | + "index,manifest:org.opencontainers.image.authors=The CloudNativePG Contributors", |
| 61 | + "index,manifest:org.opencontainers.image.licenses=Apache-2.0" |
| 62 | + ] |
| 63 | +// platforms = ["linux/amd64", "linux/arm64"] |
| 64 | +} |
0 commit comments