CI / changes (push) Successful in 8s
CI / openapi (push) Has been skipped
CI / go (push) Has been skipped
CI / docker-web (push) Failing after 16s
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Successful in 22s
CI / docker-go (push) Failing after 51s
- Added a new target "web-build" to streamline the build process for web artifacts. - Updated "evobgp-web" and "evobgp-web-all" targets to utilize the new "web-build" context. - Modified Dockerfile to reflect changes in the build stages and context for web artifacts. - Revised README to clarify the new build process and dependencies.
251 lines
5.8 KiB
HCL
251 lines
5.8 KiB
HCL
# Единая сборка образов EvoBGP (buildx bake: -f deploy/docker/docker-bake.hcl).
|
|
# context = "../.." — корень репозитория (относительно этого файла).
|
|
# dockerfile — путь от корня репозитория (относительно context).
|
|
# Переменные: REGISTRY, IMAGE_TAG, CACHE_REF_GO, CACHE_REF_WEB
|
|
|
|
variable "REGISTRY" {
|
|
default = "git.shts.su/evobgp"
|
|
}
|
|
|
|
variable "IMAGE_TAG" {
|
|
default = "latest"
|
|
}
|
|
|
|
variable "SHORT_SHA" {
|
|
default = "dev"
|
|
}
|
|
|
|
variable "SHA_FULL" {
|
|
default = ""
|
|
}
|
|
|
|
variable "CACHE_REF_GO" {
|
|
default = ""
|
|
}
|
|
|
|
variable "CACHE_REF_WEB" {
|
|
default = ""
|
|
}
|
|
|
|
function "go-cache-from" {
|
|
params = []
|
|
result = notequal("", CACHE_REF_GO) ? ["type=registry,ref=${CACHE_REF_GO}"] : []
|
|
}
|
|
|
|
function "go-cache-to" {
|
|
params = []
|
|
result = notequal("", CACHE_REF_GO) ? ["type=registry,ref=${CACHE_REF_GO},mode=max"] : []
|
|
}
|
|
|
|
function "web-cache-from" {
|
|
params = []
|
|
result = notequal("", CACHE_REF_WEB) ? ["type=registry,ref=${CACHE_REF_WEB}"] : []
|
|
}
|
|
|
|
function "web-cache-to" {
|
|
params = []
|
|
result = notequal("", CACHE_REF_WEB) ? ["type=registry,ref=${CACHE_REF_WEB},mode=max"] : []
|
|
}
|
|
|
|
group "default" {
|
|
targets = ["go-images", "web-images", "evobgp-bird2"]
|
|
}
|
|
|
|
group "go-images" {
|
|
targets = [
|
|
"evobgp-api",
|
|
"evobgp-all",
|
|
"evobgp-scheduler",
|
|
"evobgp-ingest",
|
|
"evobgp-render",
|
|
"evobgp-deploy",
|
|
"evobgp-node",
|
|
"evobgp-agent",
|
|
]
|
|
}
|
|
|
|
group "web-images" {
|
|
targets = ["web-deps", "web-build", "evobgp-web", "evobgp-web-all"]
|
|
}
|
|
|
|
# --- Go: go mod download → все cmd/* → birdc (один раз) → runtime-образы ---
|
|
|
|
target "go-deps" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/gobinary/Dockerfile"
|
|
target = "deps"
|
|
platforms = ["linux/amd64"]
|
|
cache-from = go-cache-from()
|
|
cache-to = go-cache-to()
|
|
}
|
|
|
|
target "go-build-all" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/gobinary/Dockerfile"
|
|
target = "build-all"
|
|
platforms = ["linux/amd64"]
|
|
contexts = {
|
|
deps = "target:go-deps"
|
|
}
|
|
cache-from = go-cache-from()
|
|
cache-to = go-cache-to()
|
|
}
|
|
|
|
target "go-birdc" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/gobinary/Dockerfile"
|
|
target = "birdc"
|
|
platforms = ["linux/amd64"]
|
|
cache-from = go-cache-from()
|
|
cache-to = go-cache-to()
|
|
}
|
|
|
|
target "_go-runtime" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/gobinary/Dockerfile"
|
|
target = "runtime"
|
|
platforms = ["linux/amd64"]
|
|
contexts = {
|
|
build-all = "target:go-build-all"
|
|
}
|
|
cache-from = go-cache-from()
|
|
cache-to = go-cache-to()
|
|
}
|
|
|
|
target "_go-runtime-birdc" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/gobinary/Dockerfile"
|
|
target = "runtime-birdc"
|
|
platforms = ["linux/amd64"]
|
|
contexts = {
|
|
build-all = "target:go-build-all"
|
|
birdc = "target:go-birdc"
|
|
}
|
|
cache-from = go-cache-from()
|
|
cache-to = go-cache-to()
|
|
}
|
|
|
|
function "image-tags" {
|
|
params = [name]
|
|
result = notequal("", SHA_FULL) ? [
|
|
"${REGISTRY}/${name}:${IMAGE_TAG}",
|
|
"${REGISTRY}/${name}:${SHORT_SHA}",
|
|
"${REGISTRY}/${name}:sha-${SHA_FULL}",
|
|
] : [
|
|
"${REGISTRY}/${name}:${IMAGE_TAG}",
|
|
"${REGISTRY}/${name}:${SHORT_SHA}",
|
|
]
|
|
}
|
|
|
|
target "evobgp-api" {
|
|
inherits = ["_go-runtime-birdc"]
|
|
args = { BIN = "evobgp-api" }
|
|
tags = image-tags("evobgp-api")
|
|
}
|
|
|
|
target "evobgp-all" {
|
|
inherits = ["_go-runtime-birdc"]
|
|
args = { BIN = "evobgp-all" }
|
|
tags = image-tags("evobgp-all")
|
|
}
|
|
|
|
target "evobgp-scheduler" {
|
|
inherits = ["_go-runtime"]
|
|
args = { BIN = "evobgp-scheduler" }
|
|
tags = image-tags("evobgp-scheduler")
|
|
}
|
|
|
|
target "evobgp-ingest" {
|
|
inherits = ["_go-runtime"]
|
|
args = { BIN = "evobgp-ingest" }
|
|
tags = image-tags("evobgp-ingest")
|
|
}
|
|
|
|
target "evobgp-render" {
|
|
inherits = ["_go-runtime"]
|
|
args = { BIN = "evobgp-render" }
|
|
tags = image-tags("evobgp-render")
|
|
}
|
|
|
|
target "evobgp-deploy" {
|
|
inherits = ["_go-runtime"]
|
|
args = { BIN = "evobgp-deploy" }
|
|
tags = image-tags("evobgp-deploy")
|
|
}
|
|
|
|
target "evobgp-node" {
|
|
inherits = ["_go-runtime"]
|
|
args = { BIN = "evobgp-node" }
|
|
tags = image-tags("evobgp-node")
|
|
}
|
|
|
|
target "evobgp-agent" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/evobgp-agent/Dockerfile"
|
|
platforms = ["linux/amd64"]
|
|
contexts = {
|
|
build-all = "target:go-build-all"
|
|
}
|
|
cache-from = go-cache-from()
|
|
cache-to = go-cache-to()
|
|
tags = image-tags("evobgp-agent")
|
|
}
|
|
|
|
# --- Web: npm ci (кэш) → build → nginx ---
|
|
|
|
target "web-deps" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/evobgp-web/Dockerfile"
|
|
target = "deps"
|
|
platforms = ["linux/amd64"]
|
|
cache-from = web-cache-from()
|
|
cache-to = web-cache-to()
|
|
}
|
|
|
|
target "web-build" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/evobgp-web/Dockerfile"
|
|
target = "build"
|
|
platforms = ["linux/amd64"]
|
|
contexts = {
|
|
deps = "target:web-deps"
|
|
}
|
|
cache-from = web-cache-from()
|
|
cache-to = web-cache-to()
|
|
}
|
|
|
|
target "evobgp-web" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/evobgp-web/Dockerfile"
|
|
target = "web"
|
|
platforms = ["linux/amd64"]
|
|
contexts = {
|
|
web-artifacts = "target:web-build"
|
|
}
|
|
args = { EVOBGP_UPSTREAM = "evobgp-api" }
|
|
cache-from = web-cache-from()
|
|
cache-to = web-cache-to()
|
|
tags = image-tags("evobgp-web")
|
|
}
|
|
|
|
target "evobgp-web-all" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/evobgp-web/Dockerfile"
|
|
target = "web"
|
|
platforms = ["linux/amd64"]
|
|
contexts = {
|
|
web-artifacts = "target:web-build"
|
|
}
|
|
args = { EVOBGP_UPSTREAM = "evobgp-all" }
|
|
cache-from = web-cache-from()
|
|
cache-to = web-cache-to()
|
|
tags = image-tags("evobgp-web-all")
|
|
}
|
|
|
|
target "evobgp-bird2" {
|
|
context = "../.."
|
|
dockerfile = "deploy/docker/bird2/Dockerfile"
|
|
platforms = ["linux/amd64"]
|
|
tags = image-tags("evobgp-bird2")
|
|
}
|