-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
118 lines (108 loc) · 4.39 KB
/
docker-bake.hcl
File metadata and controls
118 lines (108 loc) · 4.39 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
fullname = ( environment == "testing") ? "${registry}/postgis-testing" : "${registry}/postgis"
url = "https://github.com/cloudnative-pg/postgis-containers"
// MANUALLY EDIT THE CONTENT - to add new PostGIS major version
variable "postgisMajorVersions" {
default = [
"3"
]
}
// PostGIS matrix of distro x versions
postgisMatrix = {
bookworm = {
// renovate: suite=bookworm-pgdg depName=postgis
"3" = "3.6.2+dfsg-1.pgdg12+1"
}
trixie = {
// renovate: suite=trixie-pgdg depName=postgis
"3" = "3.6.2+dfsg-1.pgdg13+1"
}
}
variable "distributions" {
default = [
"bookworm",
"trixie"
]
}
variable "imageTypes" {
default = [
"standard",
"system"
]
}
target "postgis" {
matrix = {
tgt = imageTypes
distro = distributions
postgisMajor = postgisMajorVersions
pgVersion = getPgVersions(postgreSQLVersions, postgreSQLPreviewVersions)
}
platforms = [
"linux/amd64",
"linux/arm64"
]
dockerfile = "cwd://Dockerfile"
context = "."
name = "postgis-${postgisMajor}-${index(split(".",cleanVersion(pgVersion)),0)}-${tgt}-${distro}"
tags = [
"${fullname}:${index(split(".",cleanVersion(pgVersion)),0)}-${postgisMajor}-${tgt}-${distro}",
"${fullname}:${index(split(".",cleanVersion(pgVersion)),0)}-${getShortPostgisVersion(distro, postgisMajor)}-${tgt}-${distro}",
"${fullname}:${cleanVersion(pgVersion)}-${getPostgisVersion(distro, postgisMajor)}-${tgt}-${distro}",
"${fullname}:${cleanVersion(pgVersion)}-${getPostgisVersion(distro, postgisMajor)}-${formatdate("YYYYMMDDhhmm", now)}-${tgt}-${distro}",
]
args = {
PG_MAJOR = "${getMajor(pgVersion)}"
POSTGIS_VERSION = "${getPostgisPackage(distro, postgisMajor)}"
POSTGIS_MAJOR = postgisMajor
BASE = "${getBaseImage(pgVersion, tgt, distro)}"
}
attest = [
"type=provenance,mode=max",
"type=sbom"
]
annotations = [
"index,manifest:org.opencontainers.image.created=${now}",
"index,manifest:org.opencontainers.image.url=${url}",
"index,manifest:org.opencontainers.image.source=${url}",
"index,manifest:org.opencontainers.image.version=${pgVersion}-${getPostgisVersion(distro, postgisMajor)}",
"index,manifest:org.opencontainers.image.revision=${revision}",
"index,manifest:org.opencontainers.image.vendor=${authors}",
"index,manifest:org.opencontainers.image.title=CloudNativePG PostGIS ${pgVersion}-${getPostgisVersion(distro, postgisMajor)} ${tgt}",
"index,manifest:org.opencontainers.image.description=A ${tgt} PostGIS ${pgVersion}-${getPostgisVersion(distro, postgisMajor)} container image",
"index,manifest:org.opencontainers.image.documentation=${url}",
"index,manifest:org.opencontainers.image.authors=${authors}",
"index,manifest:org.opencontainers.image.licenses=Apache-2.0",
"index,manifest:org.opencontainers.image.base.name=${getBaseImage(pgVersion, tgt, distro)}",
]
labels = {
"org.opencontainers.image.created" = "${now}",
"org.opencontainers.image.url" = "${url}",
"org.opencontainers.image.source" = "${url}",
"org.opencontainers.image.version" = "${pgVersion}",
"org.opencontainers.image.revision" = "${revision}",
"org.opencontainers.image.vendor" = "${authors}",
"org.opencontainers.image.title" = "CloudNativePG PostGIS ${pgVersion}-${getPostgisVersion(distro, postgisMajor)} ${tgt}",
"org.opencontainers.image.description" = "A ${tgt} PostGIS ${pgVersion}-${getPostgisVersion(distro, postgisMajor)} container image",
"org.opencontainers.image.documentation" = "${url}",
"org.opencontainers.image.authors" = "${authors}",
"org.opencontainers.image.licenses" = "Apache-2.0"
"org.opencontainers.image.base.name" = "${getBaseImage(pgVersion, tgt, distro)}"
}
}
function getBaseImage {
params = [ pgVersion, imageType, distro ]
result = format("ghcr.io/cloudnative-pg/postgresql:%s-%s-%s", cleanVersion(pgVersion), imageType, distro)
}
function getPostgisPackage {
params = [distro, postgisMajor]
result = postgisMatrix[distro][postgisMajor]
}
// Gets the MM.mm.pp postgis version, e.g. "3.6.0"
function getPostgisVersion {
params = [ distro, postgisMajor ]
result = join(".", slice(split(".", split("+", getPostgisPackage(distro, postgisMajor))[0]), 0, 3))
}
// Gets the MM.mm postgis version, e.g. "3.6"
function getShortPostgisVersion {
params = [ distro, postgisMajor ]
result = join(".", slice(split(".", split("+", getPostgisPackage(distro, postgisMajor))[0]), 0, 2))
}