wordpress/build/docker-bake.hcl

187 lines
4.7 KiB
HCL
Raw Normal View History

2021-09-25 03:19:05 +02:00
group "default" {
2023-04-09 21:58:01 +02:00
targets = [
2023-05-22 23:19:23 +02:00
"6_2_0",
2023-08-06 22:03:56 +02:00
"6_2_1",
2023-09-22 21:04:01 +02:00
"6_2_2",
2023-09-22 21:18:23 +02:00
"6_3_0",
2024-05-12 22:45:48 +02:00
"6_3_1",
2024-05-12 22:46:56 +02:00
"6_3_2",
2024-05-12 23:31:39 +02:00
"6_4_0",
"6_4_1",
"6_4_2",
2024-05-12 23:37:14 +02:00
"6_4_3",
2024-05-12 23:44:50 +02:00
"6_5_0",
"6_5_2",
"6_5_3"
2023-04-09 21:58:01 +02:00
]
}
target "build-dockerfile" {
dockerfile = "Dockerfile"
}
target "build-platforms" {
platforms = ["linux/amd64", "linux/aarch64"]
2023-04-09 21:58:01 +02:00
}
target "build-common" {
pull = true
2021-09-25 03:19:05 +02:00
}
2023-04-09 21:46:50 +02:00
variable "REGISTRY_CACHE" {
2024-10-29 00:36:21 +01:00
default = "ghcr.io/n0rthernl1ghts/wordpress-cache"
2023-04-09 21:46:50 +02:00
}
2023-04-09 21:58:01 +02:00
######################
# Define the functions
######################
# Get the arguments for the build
function "get-args" {
params = [version, patch_version]
result = {
WP_VERSION = version
WP_PATCH_VERSION = patch_version
}
}
# Get the cache-from configuration
function "get-cache-from" {
params = [version]
result = [
2023-04-09 21:46:50 +02:00
"type=registry,ref=${REGISTRY_CACHE}:${sha1("${version}-${BAKE_LOCAL_PLATFORM}")}"
]
}
# Get the cache-to configuration
function "get-cache-to" {
params = [version]
result = [
2023-04-11 12:59:28 +02:00
"type=registry,mode=max,ref=${REGISTRY_CACHE}:${sha1("${version}-${BAKE_LOCAL_PLATFORM}")}"
]
}
# Get list of image tags and registries
# Takes a version and a list of extra versions to tag
# eg. get-tags("6.2.0", ["6", "6.2", "latest"])
function "get-tags" {
params = [version, extra_versions]
result = concat(
[
"ghcr.io/n0rthernl1ghts/wordpress:${version}"
],
flatten([
for extra_version in extra_versions : [
"ghcr.io/n0rthernl1ghts/wordpress:${extra_version}"
]
])
)
}
2023-04-09 21:58:01 +02:00
##########################
# Define the build targets
##########################
2021-09-25 03:19:05 +02:00
2023-04-02 20:32:47 +02:00
target "6_2_0" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.2.0")
cache-to = get-cache-to("6.2.0")
2023-05-22 23:19:23 +02:00
tags = get-tags("6.2.0", [])
args = get-args("6.2.0", "5.9.1")
}
2023-05-22 23:19:23 +02:00
target "6_2_1" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.2.1")
cache-to = get-cache-to("6.2.1")
2023-08-06 22:03:56 +02:00
tags = get-tags("6.2.1", [])
args = get-args("6.2.1", "5.9.1")
2023-05-22 23:19:23 +02:00
}
2023-08-06 22:03:56 +02:00
target "6_2_2" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.2.2")
cache-to = get-cache-to("6.2.2")
2023-09-22 21:04:01 +02:00
tags = get-tags("6.2.2", ["6.2"])
args = get-args("6.2.2", "5.9.1")
2023-08-06 22:03:56 +02:00
}
2023-09-22 21:04:01 +02:00
target "6_3_0" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.3.0")
cache-to = get-cache-to("6.3.0")
2023-09-22 21:18:23 +02:00
tags = get-tags("6.3.0", [])
2023-09-22 21:04:01 +02:00
args = get-args("6.3.0", "6.3.0")
}
2023-09-22 21:18:23 +02:00
target "6_3_1" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.3.1")
cache-to = get-cache-to("6.3.1")
2024-05-12 22:45:48 +02:00
tags = get-tags("6.3.1", [])
2023-09-22 21:18:23 +02:00
args = get-args("6.3.1", "6.3.0")
}
2024-05-12 22:45:48 +02:00
target "6_3_2" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.3.2")
cache-to = get-cache-to("6.3.2")
2024-05-12 22:46:56 +02:00
tags = get-tags("6.3.2", [])
2024-05-12 22:45:48 +02:00
args = get-args("6.3.2", "6.3.0")
}
2024-05-12 22:46:56 +02:00
2024-05-12 22:48:35 +02:00
target "6_4_0" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.4.0")
cache-to = get-cache-to("6.4.0")
2024-05-12 23:31:39 +02:00
tags = get-tags("6.4.0", [])
2024-05-12 23:25:15 +02:00
args = get-args("6.4.0", "6.4.0")
2024-05-12 23:31:39 +02:00
}
target "6_4_1" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.4.1")
cache-to = get-cache-to("6.4.1")
tags = get-tags("6.4.1", [])
args = get-args("6.4.1", "6.4.0")
}
target "6_4_2" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.4.2")
cache-to = get-cache-to("6.4.2")
tags = get-tags("6.4.2", [])
args = get-args("6.4.2", "6.4.0")
}
target "6_4_3" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.4.3")
cache-to = get-cache-to("6.4.3")
2024-05-12 23:37:14 +02:00
tags = get-tags("6.4.3", ["6.4"])
2024-05-12 23:31:39 +02:00
args = get-args("6.4.3", "6.4.0")
2024-05-12 23:37:14 +02:00
}
target "6_5_0" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.5.0")
cache-to = get-cache-to("6.5.0")
2024-05-12 23:44:50 +02:00
tags = get-tags("6.5.0", [])
2024-05-12 23:37:14 +02:00
args = get-args("6.5.0", "6.5.0")
2024-05-12 23:44:50 +02:00
}
target "6_5_2" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.5.2")
cache-to = get-cache-to("6.5.2")
tags = get-tags("6.5.2", [])
args = get-args("6.5.2", "6.5.0")
}
target "6_5_3" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
cache-from = get-cache-from("6.5.3")
cache-to = get-cache-to("6.5.3")
tags = get-tags("6.5.3", ["6", "6.5", "latest"])
args = get-args("6.5.3", "6.5.0")
2024-05-12 23:25:15 +02:00
}