This repository has been archived by the owner on Nov 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
/
docker-bake.hcl
107 lines (93 loc) · 2.17 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
# docker-bake.hcl
variable "apache_modsec_version" {
default = "2.9.6"
}
variable "nginx_modsec_version" {
default = "3.0.8"
}
variable "REPO" {
default = "owasp/modsecurity"
}
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 = ["${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"
]
}
target "docker-metadata-action" {}
target "build" {
inherits = ["docker-metadata-action"]
context = "./"
platforms = [
"linux/amd64",
"linux/arm64/v8",
"linux/arm/v7",
"linux/i386"
]
}
target "apache" {
inherits = ["build"]
dockerfile="v2-apache/Dockerfile"
tags = concat(tag("apache"),
vtag("${apache_modsec_version}", "")
)
args = {
MODSEC_VERSION = "${apache_modsec_version}"
}
}
target "apache-alpine" {
inherits = ["build"]
dockerfile="v2-apache/Dockerfile-alpine"
tags = concat(tag("apache-alpine"),
vtag("${apache_modsec_version}", "-alpine")
)
args = {
MODSEC_VERSION = "${apache_modsec_version}"
}
}
target "nginx" {
inherits = ["build"]
dockerfile="v3-nginx/Dockerfile"
tags = concat(tag("nginx"),
vtag("${nginx_modsec_version}", "")
)
args = {
MODSEC_VERSION = "${nginx_modsec_version}"
}
}
target "nginx-alpine" {
inherits = ["build"]
dockerfile="v3-nginx/Dockerfile-alpine"
tags = concat(tag("nginx-alpine"),
vtag("${nginx_modsec_version}", "-alpine")
)
args = {
MODSEC_VERSION = "${nginx_modsec_version}"
}
}