-
Notifications
You must be signed in to change notification settings - Fork 75
/
docker-bake.hcl
188 lines (163 loc) · 4.31 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# docker-bake.hcl
variable "modsec3-version" {
# renovate: depName=ModSecurity3 packageName=owasp-modsecurity/ModSecurity datasource=github-releases
default = "3.0.13"
}
variable "modsec2-version" {
# renovate: depName=ModSecurity2 packageName=owasp-modsecurity/ModSecurity datasource=github-releases
default = "2.9.8"
}
variable "crs-version" {
# renovate: depName=coreruleset/coreruleset datasource=github-releases
default = "4.9.0"
}
variable "nginx-version" {
# renovate: depName=nginxinc/nginx-unprivileged datasource=docker
default = "1.27.3"
}
variable "httpd-version" {
# renovate: depName=httpd datasource=docker
default = "2.4.62"
}
variable "openresty-version" {
# renovate: depName=openresty/openresty datasource=docker
default = "1.25.3.1"
}
variable "lua-version" {
default = "5.3"
}
variable "lmdb-version" {
default = "0.9.29"
}
variable "lua-modules-alpine" {
default = [
"lua-lzlib",
"lua-socket"
]
}
variable "lua-modules-debian" {
default = [
"lua-zlib",
"lua-socket"
]
}
variable "lua-modules-luarocks" {
default = [
"lua-resty-openidc",
"lua-zlib",
"luasocket"
]
}
variable "REPOS" {
# List of repositories to tag
default = [
"owasp/modsecurity-crs",
"ghcr.io/coreruleset/modsecurity-crs",
]
}
function "major" {
params = [version]
result = split(".", version)[0]
}
function "minor" {
params = [version]
result = join(".", slice(split(".", version),0,2))
}
function "patch" {
params = [version]
result = join(".", slice(split(".", version),0,3))
}
function "tag" {
params = [tag]
result = [for repo in REPOS : "${repo}:${tag}"]
}
function "vtag" {
params = [semver, variant]
result = concat(
tag("${major(semver)}-${variant}-${formatdate("YYYYMMDDHHMM", timestamp())}"),
tag("${minor(semver)}-${variant}-${formatdate("YYYYMMDDHHMM", timestamp())}"),
tag("${patch(semver)}-${variant}-${formatdate("YYYYMMDDHHMM", timestamp())}")
)
}
group "default" {
targets = [
"apache",
"apache-alpine",
"nginx",
"nginx-alpine",
"openresty-alpine-fat"
]
}
target "docker-metadata-action" {}
target "platforms-base" {
inherits = ["docker-metadata-action"]
context="."
platforms = ["linux/amd64", "linux/arm64/v8", "linux/arm/v7", "linux/i386"]
labels = {
"org.opencontainers.image.source" = "https://github.com/coreruleset/modsecurity-crs-docker"
}
args = {
CRS_RELEASE = "${crs-version}"
MODSEC2_VERSION = "${modsec2-version}"
MODSEC3_VERSION = "${modsec3-version}"
LUA_VERSION = "${lua-version}"
LMDB_VERSION = "${lmdb-version}"
}
}
target "apache" {
inherits = ["platforms-base"]
dockerfile="apache/Dockerfile"
args = {
HTTPD_VERSION = "${httpd-version}"
LUA_MODULES = join(" ", lua-modules-debian)
}
tags = concat(tag("apache"),
vtag("${crs-version}", "apache")
)
}
target "apache-alpine" {
inherits = ["platforms-base"]
dockerfile="apache/Dockerfile-alpine"
args = {
HTTPD_VERSION = "${httpd-version}"
LUA_MODULES = join(" ", lua-modules-alpine)
}
tags = concat(tag("apache-alpine"),
vtag("${crs-version}", "apache-alpine")
)
}
target "nginx" {
inherits = ["platforms-base"]
dockerfile="nginx/Dockerfile"
args = {
NGINX_VERSION = "${nginx-version}"
LUA_MODULES = join(" ", lua-modules-debian)
}
tags = concat(tag("nginx"),
vtag("${crs-version}", "nginx")
)
}
target "nginx-alpine" {
inherits = ["platforms-base"]
dockerfile="nginx/Dockerfile-alpine"
args = {
NGINX_VERSION = "${nginx-version}"
LUA_MODULES = join(" ", lua-modules-alpine)
}
tags = concat(tag("nginx-alpine"),
vtag("${crs-version}", "nginx-alpine")
)
}
target "openresty-alpine-fat" {
inherits = ["platforms-base"]
platforms = ["linux/amd64", "linux/arm64/v8"]
dockerfile="openresty/Dockerfile-alpine"
args = {
OPENRESTY_VERSION = "${openresty-version}"
NGINX_VERSION = patch(openresty-version)
LUA_MODULES = join(" ", lua-modules-luarocks)
}
tags = concat(tag("openresty-alpine-fat"),
vtag("${crs-version}", "openresty-alpine-fat")
)
}