-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathdocker-bake.hcl
109 lines (102 loc) · 3.81 KB
/
docker-bake.hcl
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
variable "environment" {
default = "testing"
validation {
condition = contains(["testing", "production"], environment)
error_message = "environment must be either testing or production"
}
}
variable "registry" {
default = "localhost:5000"
}
// Use the revision variable to identify the commit that generated the image
variable "revision" {
default = ""
}
fullname = ( environment == "testing") ? "${registry}/postgresql-testing" : "${registry}/postgresql"
now = timestamp()
authors = "The CloudNativePG Contributors"
url = "https://github.com/cloudnative-pg/postgres-containers"
target "default" {
matrix = {
tgt = [
"minimal",
"standard"
]
pgVersion = [
"13.20",
"14.17",
"15.12",
"16.8",
"17.4"
]
base = [
// renovate: datasource=docker versioning=loose
"debian:bookworm-slim@sha256:12c396bd585df7ec21d5679bb6a83d4878bc4415ce926c9e5ea6426d23c60bdc",
// renovate: datasource=docker versioning=loose
"debian:bullseye-slim@sha256:33b7c2e071c29e618182ec872c471f39d2dde3d8904d95f5b7a61acf3a592e7b"
]
}
platforms = [
"linux/amd64",
"linux/arm64"
]
dockerfile = "Dockerfile"
name = "postgresql-${index(split(".",pgVersion),0)}-${tgt}-${distroVersion(base)}"
tags = [
"${fullname}:${index(split(".",pgVersion),0)}-${tgt}-${distroVersion(base)}",
"${fullname}:${pgVersion}-${tgt}-${distroVersion(base)}",
"${fullname}:${pgVersion}-${formatdate("YYYYMMDDhhmm", now)}-${tgt}-${distroVersion(base)}"
]
context = "."
target = "${tgt}"
args = {
PG_VERSION = "${pgVersion}"
BASE = "${base}"
}
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}",
"index,manifest:org.opencontainers.image.revision=${revision}",
"index,manifest:org.opencontainers.image.vendor=${authors}",
"index,manifest:org.opencontainers.image.title=CloudNativePG PostgreSQL ${pgVersion} ${tgt}",
"index,manifest:org.opencontainers.image.description=A ${tgt} PostgreSQL ${pgVersion} container image",
"index,manifest:org.opencontainers.image.documentation=https://github.com/cloudnative-pg/postgres-containers",
"index,manifest:org.opencontainers.image.authors=${authors}",
"index,manifest:org.opencontainers.image.licenses=Apache-2.0",
"index,manifest:org.opencontainers.image.base.name=docker.io/library/${tag(base)}",
"index,manifest:org.opencontainers.image.base.digest=${digest(base)}"
]
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 PostgreSQL ${pgVersion} ${tgt}",
"org.opencontainers.image.description" = "A ${tgt} PostgreSQL ${pgVersion} container image",
"org.opencontainers.image.documentation" = "${url}",
"org.opencontainers.image.authors" = "${authors}",
"org.opencontainers.image.licenses" = "Apache-2.0"
"org.opencontainers.image.base.name" = "docker.io/library/debian:${tag(base)}"
"org.opencontainers.image.base.digest" = "${digest(base)}"
}
}
function tag {
params = [ imageNameWithSha ]
result = index(split("@", index(split(":", imageNameWithSha), 1)), 0)
}
function distroVersion {
params = [ imageNameWithSha ]
result = index(split("-", tag(imageNameWithSha)), 0)
}
function digest {
params = [ imageNameWithSha ]
result = index(split("@", imageNameWithSha), 1)
}