47 lines
1.6 KiB
HCL
47 lines
1.6 KiB
HCL
# Kit template — copy to the repo root (or pass -f).
|
|
# Invoked from the repo root. cwd:// keeps contexts relative to that
|
|
# working directory, not this file.
|
|
#
|
|
# CD must cap the builder cgroup (scripts/cap-buildx-builder.sh)
|
|
# and bake one target at a time. The runner host also runs Gitea.
|
|
#
|
|
# The API Dockerfile must end with `final` and expose a slim
|
|
# `migrate-bundle` stage (scratch + /out/migrate-api + CMD). Do not bake the
|
|
# SDK `migrate` stage into the daemon.
|
|
#
|
|
# Substitute: <owner>, <repo-slug>, api/, web/ (drop ui target if no SPA image).
|
|
|
|
variable "REGISTRY" {}
|
|
variable "TAG" {}
|
|
|
|
group "default" {
|
|
targets = ["api", "ui", "migrate"]
|
|
}
|
|
|
|
target "api" {
|
|
context = "cwd://api"
|
|
dockerfile = "Dockerfile"
|
|
target = "final"
|
|
tags = ["${REGISTRY}/<repo-slug>-api:${TAG}", "${REGISTRY}/<repo-slug>-api:latest"]
|
|
cache-from = ["type=registry,ref=${REGISTRY}/<repo-slug>-api:buildcache"]
|
|
cache-to = ["type=registry,ref=${REGISTRY}/<repo-slug>-api:buildcache,mode=max"]
|
|
}
|
|
|
|
target "ui" {
|
|
context = "cwd://web"
|
|
dockerfile = "Dockerfile"
|
|
target = "final"
|
|
tags = ["${REGISTRY}/<repo-slug>-ui:${TAG}", "${REGISTRY}/<repo-slug>-ui:latest"]
|
|
cache-from = ["type=registry,ref=${REGISTRY}/<repo-slug>-ui:buildcache"]
|
|
cache-to = ["type=registry,ref=${REGISTRY}/<repo-slug>-ui:buildcache,mode=max"]
|
|
}
|
|
|
|
target "migrate" {
|
|
context = "cwd://api"
|
|
dockerfile = "Dockerfile"
|
|
target = "migrate-bundle"
|
|
tags = ["<repo-slug>-migrate-bundle:local"]
|
|
cache-from = ["type=registry,ref=${REGISTRY}/<repo-slug>-api:buildcache"]
|
|
# no cache-to — api already exports this Dockerfile at mode=max
|
|
}
|