mirror of
https://github.com/N0rthernL1ghts/wordpress.git
synced 2024-11-23 14:13:27 +01:00
Simlify, and refactor to use functions
This should greatly reduce duplication and overall size
This commit is contained in:
parent
a6080cbef0
commit
e39555b0b1
|
@ -2,6 +2,51 @@ group "default" {
|
||||||
targets = ["5_9_0", "5_9_1", "5_9_2", "5_9_3", "6_0_0", "6_0_1", "6_0_2", "6_0_3", "6_1_0", "6_1_1", "6_2_0"]
|
targets = ["5_9_0", "5_9_1", "5_9_2", "5_9_3", "6_0_0", "6_0_1", "6_0_2", "6_0_3", "6_1_0", "6_1_1", "6_2_0"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get the arguments for the build
|
||||||
|
function "get-args" {
|
||||||
|
params = [version]
|
||||||
|
result = {
|
||||||
|
WP_VERSION = version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get the cache-from configuration
|
||||||
|
function "get-cache-from" {
|
||||||
|
params = [version]
|
||||||
|
result = [
|
||||||
|
"type=gha,scope=${version}_${BAKE_LOCAL_PLATFORM}",
|
||||||
|
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("${version}-${BAKE_LOCAL_PLATFORM}")}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get the cache-to configuration
|
||||||
|
function "get-cache-to" {
|
||||||
|
params = [version]
|
||||||
|
result = [
|
||||||
|
"type=gha,mode=max,scope=${version}_${BAKE_LOCAL_PLATFORM}",
|
||||||
|
"type=registry,mode=max,ref=docker.io/nlss/wordpress-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("5.9.0", ["5", "5.9", "latest"])
|
||||||
|
function "get-tags" {
|
||||||
|
params = [version, extra_versions]
|
||||||
|
result = concat(
|
||||||
|
[
|
||||||
|
"docker.io/nlss/wordpress:${version}",
|
||||||
|
"ghcr.io/n0rthernl1ghts/wordpress:${version}"
|
||||||
|
],
|
||||||
|
flatten([
|
||||||
|
for extra_version in extra_versions : [
|
||||||
|
"docker.io/nlss/wordpress:${extra_version}",
|
||||||
|
"ghcr.io/n0rthernl1ghts/wordpress:${extra_version}"
|
||||||
|
]
|
||||||
|
])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
target "build-dockerfile" {
|
target "build-dockerfile" {
|
||||||
dockerfile = "Dockerfile"
|
dockerfile = "Dockerfile"
|
||||||
}
|
}
|
||||||
|
@ -15,224 +60,89 @@ target "build-common" {
|
||||||
}
|
}
|
||||||
|
|
||||||
target "5_9_0" {
|
target "5_9_0" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("5.9.0")
|
||||||
cache-from = [
|
cache-to = get-cache-to("5.9.0")
|
||||||
"type=gha,scope=5_9_0_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("5.9.0", [])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("5.9.0-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("5.9.0")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=5_9_0_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("5.9.0-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = ["docker.io/nlss/wordpress:5.9.0", "ghcr.io/n0rthernl1ghts/wordpress:5.9.0"]
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "5.9.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "5_9_1" {
|
target "5_9_1" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("5.9.1")
|
||||||
cache-from = [
|
cache-to = get-cache-to("5.9.1")
|
||||||
"type=gha,scope=5_9_1_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("5.9.1", [])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("5.9.1-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("5.9.1")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=5_9_1_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("5.9.1-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = ["docker.io/nlss/wordpress:5.9.1", "ghcr.io/n0rthernl1ghts/wordpress:5.9.1"]
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "5.9.1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "5_9_2" {
|
target "5_9_2" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("5.9.2")
|
||||||
cache-from = [
|
cache-to = get-cache-to("5.9.2")
|
||||||
"type=gha,scope=5_9_2_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("5.9.2", [])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("5.9.2-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("5.9.2")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=5_9_2_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("5.9.2-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = ["docker.io/nlss/wordpress:5.9.2", "ghcr.io/n0rthernl1ghts/wordpress:5.9.2"]
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "5.9.2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "5_9_3" {
|
target "5_9_3" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("5.9.3")
|
||||||
cache-from = [
|
cache-to = get-cache-to("5.9.3")
|
||||||
"type=gha,scope=5_9_3_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("5.9.3", ["5", "5.9"])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("5.9.3-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("5.9.3")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=5_9_3_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("5.9.3-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = [
|
|
||||||
"docker.io/nlss/wordpress:5", "docker.io/nlss/wordpress:5.9", "docker.io/nlss/wordpress:5.9.3",
|
|
||||||
"ghcr.io/n0rthernl1ghts/wordpress:5", "ghcr.io/n0rthernl1ghts/wordpress:5.9",
|
|
||||||
"ghcr.io/n0rthernl1ghts/wordpress:5.9.3"
|
|
||||||
]
|
|
||||||
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "5.9.3"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "6_0_0" {
|
target "6_0_0" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("6.0.0")
|
||||||
cache-from = [
|
cache-to = get-cache-to("6.0.0")
|
||||||
"type=gha,scope=6_0_0_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("6.0.0", [])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("6.0.0-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("6.0.0")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=6_0_0_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("6.0.0-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = ["docker.io/nlss/wordpress:6.0.0", "ghcr.io/n0rthernl1ghts/wordpress:6.0.0"]
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "6.0.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "6_0_1" {
|
target "6_0_1" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("6.0.1")
|
||||||
cache-from = [
|
cache-to = get-cache-to("6.0.1")
|
||||||
"type=gha,scope=6_0_1_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("6.0.1", [])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("6.0.1-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("6.0.1")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=6_0_1_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("6.0.1-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = ["docker.io/nlss/wordpress:6.0.1", "ghcr.io/n0rthernl1ghts/wordpress:6.0.1"]
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "6.0.1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "6_0_2" {
|
target "6_0_2" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("6.0.2")
|
||||||
cache-from = [
|
cache-to = get-cache-to("6.0.2")
|
||||||
"type=gha,scope=6_0_2_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("6.0.2", [])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("6.0.2-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("6.0.2")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=6_0_2_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("6.0.2-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = ["docker.io/nlss/wordpress:6.0.2", "ghcr.io/n0rthernl1ghts/wordpress:6.0.2"]
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "6.0.2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "6_0_3" {
|
target "6_0_3" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("6.0.3")
|
||||||
cache-from = [
|
cache-to = get-cache-to("6.0.3")
|
||||||
"type=gha,scope=6_0_3_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("6.0.3", ["6.0"])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("6.0.3-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("6.0.3")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=6_0_3_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("6.0.3-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = ["docker.io/nlss/wordpress:6.0.3", "ghcr.io/n0rthernl1ghts/wordpress:6.0.3"]
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "6.0.3"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "6_1_0" {
|
target "6_1_0" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("6.1.0")
|
||||||
cache-from = [
|
cache-to = get-cache-to("6.1.0")
|
||||||
"type=gha,scope=6_1_0_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("6.1.0", [])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("6.1.0-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("6.1.0")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=6_1_0_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("6.1.0-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = ["docker.io/nlss/wordpress:6.1.0", "ghcr.io/n0rthernl1ghts/wordpress:6.1.0"]
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "6.1.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "6_1_1" {
|
target "6_1_1" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("6.1.1")
|
||||||
cache-from = [
|
cache-to = get-cache-to("6.1.1")
|
||||||
"type=gha,scope=6_1_1_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("6.1.1", ["6", "6.1"])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("6.1.1-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("6.1.1")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=6_1_1_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("6.1.1-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = [
|
|
||||||
"docker.io/nlss/wordpress:6.1", "docker.io/nlss/wordpress:6.1.1", "ghcr.io/n0rthernl1ghts/wordpress:6.1",
|
|
||||||
"ghcr.io/n0rthernl1ghts/wordpress:6.1.1"
|
|
||||||
]
|
|
||||||
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "6.1.1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "6_2_0" {
|
target "6_2_0" {
|
||||||
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
inherits = ["build-dockerfile", "build-platforms", "build-common"]
|
||||||
|
cache-from = get-cache-from("6.2.0")
|
||||||
cache-from = [
|
cache-to = get-cache-to("6.2.0")
|
||||||
"type=gha,scope=6_2_0_${BAKE_LOCAL_PLATFORM}",
|
tags = get-tags("6.2.0", ["6", "6.2", "latest"])
|
||||||
"type=registry,ref=docker.io/nlss/wordpress-cache:${sha1("6.2.0-${BAKE_LOCAL_PLATFORM}")}"
|
args = get-args("6.2.0")
|
||||||
]
|
|
||||||
|
|
||||||
cache-to = [
|
|
||||||
"type=gha,mode=max,scope=6_2_0_${BAKE_LOCAL_PLATFORM}",
|
|
||||||
"type=registry,mode=max,ref=docker.io/nlss/wordpress-cache:${sha1("6.2.0-${BAKE_LOCAL_PLATFORM}")}"
|
|
||||||
]
|
|
||||||
|
|
||||||
tags = [
|
|
||||||
"docker.io/nlss/wordpress:6", "docker.io/nlss/wordpress:6.2", "docker.io/nlss/wordpress:6.2.0",
|
|
||||||
"docker.io/nlss/wordpress:latest", "ghcr.io/n0rthernl1ghts/wordpress:6", "ghcr.io/n0rthernl1ghts/wordpress:6.2",
|
|
||||||
"ghcr.io/n0rthernl1ghts/wordpress:6.2.0", "ghcr.io/n0rthernl1ghts/wordpress:latest"
|
|
||||||
]
|
|
||||||
|
|
||||||
args = {
|
|
||||||
WP_VERSION = "6.2.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user