@@ -17,11 +17,22 @@ variable "modsec2-flags" {
1717 default = " --with-yajl --with-ssdeep --with-pcre2"
1818}
1919
20- variable "crs-version" {
20+ variable "previous-major-crs-version" {
21+ default = " 3.3.7"
22+ }
23+
24+ variable "major-crs-version" {
2125 # renovate: depName=coreruleset/coreruleset datasource=github-releases
2226 default = " 4.18.0"
2327}
2428
29+ variable "crs-versions" {
30+ default = {
31+ " previous" = previous- major- crs- version,
32+ " latest" = major- crs- version
33+ }
34+ }
35+
2536variable "nginx-version" {
2637 # renovate: depName=nginxinc/nginx-unprivileged datasource=docker
2738 default = " 1.28.0"
@@ -115,7 +126,6 @@ target "platforms-base" {
115126 " org.opencontainers.image.source" = " https://github.com/coreruleset/modsecurity-crs-docker"
116127 }
117128 args = {
118- CRS_RELEASE = " ${ crs-version } "
119129 MODSEC2_VERSION = " ${ modsec2-version } "
120130 MODSEC2_FLAGS = modsec2- flags
121131 MODSEC3_VERSION = " ${ modsec3-version } "
@@ -127,6 +137,7 @@ target "platforms-base" {
127137
128138target "apache" {
129139 matrix = {
140+ crs_release = crs- versions
130141 base = [
131142 {
132143 name = " debian"
@@ -146,21 +157,23 @@ target "apache" {
146157 }
147158
148159 inherits = [" platforms-base" ]
149- name = " apache-${ base . name } "
160+ name = " apache-${ base . name } - ${ replace (crs_release, " . " , " - " ) } "
150161 contexts = {
151162 image = base.image
152163 }
153164 dockerfile = base. dockerfile
154165 args = {
166+ CRS_RELEASE = " ${ crs_release } "
155167 LUA_MODULES = base.lua_modules
156168 }
157169 tags = concat (tag (base. tag_base ),
158- vtag (" ${ crs-version } " , base. tag_base )
170+ vtag (" ${ crs_release } " , base. tag_base )
159171 )
160172}
161173
162174target "nginx" {
163175 matrix = {
176+ crs_release = crs- versions
164177 base = [
165178 {
166179 name = " debian"
@@ -175,6 +188,7 @@ target "nginx" {
175188 image = " docker-image://nginxinc/nginx-unprivileged:${ nginx-version } -alpine"
176189 lua_modules = join (" " , lua- modules- alpine)
177190 tag_base = " nginx-alpine"
191+ crs_release = crs- versions
178192 }
179193 ],
180194 read-only-fs = [
@@ -189,19 +203,20 @@ target "nginx" {
189203 ]
190204 }
191205 inherits = [" platforms-base" ]
192- name = " nginx-${ base . name } -${ read-only-fs . name } "
206+ name = " nginx-${ base . name } -${ read-only-fs . name } - ${ replace (crs_release, " . " , " - " ) } "
193207 contexts = {
194208 image = base.image
195209 }
196210 dockerfile = base. dockerfile
197211 args = {
212+ CRS_RELEASE = crs_release
198213 NGINX_VERSION = nginx- version
199214 LUA_MODULES = base.lua_modules
200215 NGINX_DYNAMIC_MODULES = join (" " , [for mod in nginx-dynamic-modules : join (" " , [mod . owner , mod . name , mod . version ])])
201216 NGINX_HOME = " /etc/nginx"
202217 READ_ONLY_FS = read- only- fs.read- only
203218 }
204219 tags = concat (tag (" ${ base . tag_base } ${ equal (read- only- fs. read-only , " true" ) ? " -read-only" : " " } " ),
205- vtag (" ${ crs-version } " , " ${ base . tag_base } ${ equal (read- only- fs. read-only , " true" ) ? " -read-only" : " " } " )
220+ vtag (" ${ crs_release } " , " ${ base . tag_base } ${ equal (read- only- fs. read-only , " true" ) ? " -read-only" : " " } " )
206221 )
207222}
0 commit comments