2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-14 00:54:07 +00:00
frappe_docker/docker-bake.hcl

96 lines
2.3 KiB
HCL
Raw Normal View History

# Docker Buildx Bake build definition file
# Reference: https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md
2021-12-13 16:20:44 +00:00
variable "USERNAME" {
default = "frappe"
}
variable "FRAPPE_VERSION" {
default = "develop"
}
2021-12-13 16:20:44 +00:00
variable "ERPNEXT_VERSION" {
default = "develop"
}
# Bench image
2021-10-26 12:16:57 +00:00
target "bench" {
2021-12-17 08:53:09 +00:00
context = "build/bench"
target = "bench"
2021-10-26 12:16:57 +00:00
tags = ["frappe/bench:latest"]
2021-11-04 12:31:49 +00:00
}
target "bench-test" {
inherits = ["bench"]
2021-12-17 08:53:09 +00:00
target = "bench-test"
2021-10-26 12:16:57 +00:00
}
# Main images
# Base for all other targets
2021-12-13 16:20:44 +00:00
group "frappe" {
2021-12-13 16:23:54 +00:00
targets = ["frappe-worker", "frappe-nginx", "frappe-socketio"]
2021-10-26 12:16:57 +00:00
}
2021-12-13 16:20:44 +00:00
group "erpnext" {
2021-12-13 16:23:54 +00:00
targets = ["erpnext-worker", "erpnext-nginx"]
2021-10-26 12:16:57 +00:00
}
2021-12-13 16:20:44 +00:00
group "default" {
targets = ["frappe", "erpnext"]
2021-10-26 12:16:57 +00:00
}
2021-12-13 16:20:44 +00:00
function "tag" {
params = [repo, version]
result = [
# If `version` param is develop (development build) then use tag `latest`
"${version}" == "develop" ? "${USERNAME}/${repo}:latest" : "${USERNAME}/${repo}:${version}",
# Make short tag for major version if possible. For example, from v13.16.0 make v13.
can(regex("(v[0-9]+)[.]", "${version}")) ? "${USERNAME}/${repo}:${regex("(v[0-9]+)[.]", "${version}")[0]}" : "",
]
2021-11-04 12:31:49 +00:00
}
2021-12-13 16:20:44 +00:00
target "default-args" {
args = {
2021-12-13 16:20:44 +00:00
FRAPPE_VERSION = "${FRAPPE_VERSION}"
ERPNEXT_VERSION = "${ERPNEXT_VERSION}"
# If `ERPNEXT_VERSION` variable contains "v12" use Python 3.7. Else — 3.9.
PYTHON_VERSION = can(regex("v12", "${ERPNEXT_VERSION}")) ? "3.7" : "3.9"
}
}
2021-12-13 16:20:44 +00:00
target "frappe-worker" {
inherits = ["default-args"]
context = "build/worker"
2021-12-13 16:20:44 +00:00
target = "frappe"
tags = tag("frappe-worker", "${FRAPPE_VERSION}")
2021-11-04 12:31:49 +00:00
}
2021-12-13 16:20:44 +00:00
target "erpnext-worker" {
inherits = ["default-args"]
context = "build/worker"
2021-12-13 16:20:44 +00:00
target = "erpnext"
tags = tag("erpnext-worker", "${ERPNEXT_VERSION}")
2021-11-04 12:31:49 +00:00
}
2021-12-13 16:20:44 +00:00
target "frappe-nginx" {
inherits = ["default-args"]
context = "build/nginx"
2021-12-13 16:20:44 +00:00
target = "frappe"
tags = tag("frappe-nginx", "${FRAPPE_VERSION}")
}
2021-12-13 16:20:44 +00:00
target "erpnext-nginx" {
inherits = ["default-args"]
context = "build/nginx"
2021-12-13 16:20:44 +00:00
target = "erpnext"
tags = tag("erpnext-nginx", "${ERPNEXT_VERSION}")
2021-11-04 12:31:49 +00:00
}
2021-12-13 16:20:44 +00:00
target "frappe-socketio" {
inherits = ["default-args"]
context = "build/socketio"
2021-12-13 16:20:44 +00:00
tags = tag("frappe-socketio", "${FRAPPE_VERSION}")
2021-11-04 12:31:49 +00:00
}