2021-09-04 04:49:59 +08:00
|
|
|
variable "GO_VERSION" {
|
2023-02-22 21:37:50 +08:00
|
|
|
default = "1.20"
|
2021-09-04 04:49:59 +08:00
|
|
|
}
|
2021-09-09 16:29:08 +08:00
|
|
|
variable "DOCS_FORMATS" {
|
|
|
|
default = "md"
|
|
|
|
}
|
2022-10-24 05:03:55 +08:00
|
|
|
variable "DESTDIR" {
|
|
|
|
default = "./bin"
|
|
|
|
}
|
2021-09-04 04:49:59 +08:00
|
|
|
|
2022-10-24 05:03:55 +08:00
|
|
|
# Special target: https://github.com/docker/metadata-action#bake-definition
|
2021-09-04 04:49:59 +08:00
|
|
|
target "meta-helper" {
|
|
|
|
tags = ["docker/buildx-bin:local"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "_common" {
|
|
|
|
args = {
|
|
|
|
GO_VERSION = GO_VERSION
|
|
|
|
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group "default" {
|
|
|
|
targets = ["binaries"]
|
|
|
|
}
|
|
|
|
|
|
|
|
group "validate" {
|
|
|
|
targets = ["lint", "validate-vendor", "validate-docs"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "lint" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
|
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "validate-vendor" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
|
|
|
|
target = "validate"
|
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "validate-docs" {
|
|
|
|
inherits = ["_common"]
|
2021-09-09 16:29:08 +08:00
|
|
|
args = {
|
|
|
|
FORMATS = DOCS_FORMATS
|
2022-12-17 01:41:34 +08:00
|
|
|
BUILDX_EXPERIMENTAL = 1 // enables experimental cmds/flags for docs generation
|
2021-09-09 16:29:08 +08:00
|
|
|
}
|
2021-09-04 04:49:59 +08:00
|
|
|
dockerfile = "./hack/dockerfiles/docs.Dockerfile"
|
|
|
|
target = "validate"
|
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "validate-authors" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
dockerfile = "./hack/dockerfiles/authors.Dockerfile"
|
|
|
|
target = "validate"
|
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
2022-08-29 13:14:14 +08:00
|
|
|
target "validate-generated-files" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
dockerfile = "./hack/dockerfiles/generated-files.Dockerfile"
|
|
|
|
target = "validate"
|
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
2021-09-04 04:49:59 +08:00
|
|
|
target "update-vendor" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
|
|
|
|
target = "update"
|
|
|
|
output = ["."]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "update-docs" {
|
|
|
|
inherits = ["_common"]
|
2021-09-09 16:29:08 +08:00
|
|
|
args = {
|
|
|
|
FORMATS = DOCS_FORMATS
|
2022-12-17 01:41:34 +08:00
|
|
|
BUILDX_EXPERIMENTAL = 1 // enables experimental cmds/flags for docs generation
|
2021-09-09 16:29:08 +08:00
|
|
|
}
|
2021-09-04 04:49:59 +08:00
|
|
|
dockerfile = "./hack/dockerfiles/docs.Dockerfile"
|
|
|
|
target = "update"
|
|
|
|
output = ["./docs/reference"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "update-authors" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
dockerfile = "./hack/dockerfiles/authors.Dockerfile"
|
|
|
|
target = "update"
|
|
|
|
output = ["."]
|
|
|
|
}
|
|
|
|
|
2022-08-29 13:14:14 +08:00
|
|
|
target "update-generated-files" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
dockerfile = "./hack/dockerfiles/generated-files.Dockerfile"
|
|
|
|
target = "update"
|
|
|
|
output = ["."]
|
|
|
|
}
|
|
|
|
|
2021-09-05 00:57:10 +08:00
|
|
|
target "mod-outdated" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
|
|
|
|
target = "outdated"
|
2022-03-10 09:11:12 +08:00
|
|
|
no-cache-filter = ["outdated"]
|
2021-09-05 00:57:10 +08:00
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
2021-09-04 04:49:59 +08:00
|
|
|
target "test" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
target = "test-coverage"
|
2022-10-24 05:03:55 +08:00
|
|
|
output = ["${DESTDIR}/coverage"]
|
2021-09-04 04:49:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
target "binaries" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
target = "binaries"
|
2022-10-24 05:03:55 +08:00
|
|
|
output = ["${DESTDIR}/build"]
|
2021-09-04 04:49:59 +08:00
|
|
|
platforms = ["local"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "binaries-cross" {
|
|
|
|
inherits = ["binaries"]
|
|
|
|
platforms = [
|
|
|
|
"darwin/amd64",
|
|
|
|
"darwin/arm64",
|
|
|
|
"linux/amd64",
|
|
|
|
"linux/arm/v6",
|
|
|
|
"linux/arm/v7",
|
|
|
|
"linux/arm64",
|
|
|
|
"linux/ppc64le",
|
|
|
|
"linux/riscv64",
|
|
|
|
"linux/s390x",
|
|
|
|
"windows/amd64",
|
|
|
|
"windows/arm64"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "release" {
|
|
|
|
inherits = ["binaries-cross"]
|
|
|
|
target = "release"
|
2022-10-24 05:03:55 +08:00
|
|
|
output = ["${DESTDIR}/release"]
|
2021-09-04 04:49:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
target "image" {
|
|
|
|
inherits = ["meta-helper", "binaries"]
|
|
|
|
output = ["type=image"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "image-cross" {
|
|
|
|
inherits = ["meta-helper", "binaries-cross"]
|
|
|
|
output = ["type=image"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "image-local" {
|
|
|
|
inherits = ["image"]
|
|
|
|
output = ["type=docker"]
|
|
|
|
}
|
2023-05-16 01:48:58 +08:00
|
|
|
|
|
|
|
variable "HTTP_PROXY" {
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
variable "HTTPS_PROXY" {
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
variable "NO_PROXY" {
|
|
|
|
default = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
target "integration-test-base" {
|
|
|
|
inherits = ["_common"]
|
|
|
|
args = {
|
|
|
|
HTTP_PROXY = HTTP_PROXY
|
|
|
|
HTTPS_PROXY = HTTPS_PROXY
|
|
|
|
NO_PROXY = NO_PROXY
|
|
|
|
}
|
|
|
|
target = "integration-test-base"
|
|
|
|
output = ["type=cacheonly"]
|
|
|
|
}
|
|
|
|
|
|
|
|
target "integration-test" {
|
|
|
|
inherits = ["integration-test-base"]
|
|
|
|
target = "integration-test"
|
|
|
|
}
|