-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
docker-bake.hcl
113 lines (95 loc) · 2.74 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
# Docker Buildx Bake build definition file
# Reference: https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md
variable "REGISTRY_USER" {
default = "frappe"
}
variable PYTHON_VERSION {
default = "3.11.6"
}
variable NODE_VERSION {
default = "18.18.2"
}
variable "FRAPPE_VERSION" {
default = "develop"
}
variable "ERPNEXT_VERSION" {
default = "develop"
}
variable "FRAPPE_REPO" {
default = "https://github.com/frappe/frappe"
}
variable "ERPNEXT_REPO" {
default = "https://github.com/frappe/erpnext"
}
variable "BENCH_REPO" {
default = "https://github.com/frappe/bench"
}
variable "LATEST_BENCH_RELEASE" {
default = "latest"
}
# Bench image
target "bench" {
args = {
GIT_REPO = "${BENCH_REPO}"
}
context = "images/bench"
target = "bench"
tags = [
"frappe/bench:${LATEST_BENCH_RELEASE}",
"frappe/bench:latest",
]
}
target "bench-test" {
inherits = ["bench"]
target = "bench-test"
}
# Main images
# Base for all other targets
group "default" {
targets = ["erpnext", "base", "build"]
}
function "tag" {
params = [repo, version]
result = [
# Push frappe or erpnext branch as tag
"${REGISTRY_USER}/${repo}:${version}",
# If `version` param is develop (development build) then use tag `latest`
"${version}" == "develop" ? "${REGISTRY_USER}/${repo}:latest" : "${REGISTRY_USER}/${repo}:${version}",
# Make short tag for major version if possible. For example, from v13.16.0 make v13.
can(regex("(v[0-9]+)[.]", "${version}")) ? "${REGISTRY_USER}/${repo}:${regex("(v[0-9]+)[.]", "${version}")[0]}" : "",
# Make short tag for major version if possible. For example, from v13.16.0 make version-13.
can(regex("(v[0-9]+)[.]", "${version}")) ? "${REGISTRY_USER}/${repo}:version-${regex("([0-9]+)[.]", "${version}")[0]}" : "",
]
}
target "default-args" {
args = {
FRAPPE_PATH = "${FRAPPE_REPO}"
ERPNEXT_PATH = "${ERPNEXT_REPO}"
BENCH_REPO = "${BENCH_REPO}"
FRAPPE_BRANCH = "${FRAPPE_VERSION}"
ERPNEXT_BRANCH = "${ERPNEXT_VERSION}"
PYTHON_VERSION = "${PYTHON_VERSION}"
NODE_VERSION = "${NODE_VERSION}"
}
}
target "erpnext" {
inherits = ["default-args"]
context = "."
dockerfile = "images/production/Containerfile"
target = "erpnext"
tags = tag("erpnext", "${ERPNEXT_VERSION}")
}
target "base" {
inherits = ["default-args"]
context = "."
dockerfile = "images/production/Containerfile"
target = "base"
tags = tag("base", "${FRAPPE_VERSION}")
}
target "build" {
inherits = ["default-args"]
context = "."
dockerfile = "images/production/Containerfile"
target = "build"
tags = tag("build", "${ERPNEXT_VERSION}")
}