# 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: , , 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}/-api:${TAG}", "${REGISTRY}/-api:latest"] cache-from = ["type=registry,ref=${REGISTRY}/-api:buildcache"] cache-to = ["type=registry,ref=${REGISTRY}/-api:buildcache,mode=max"] } target "ui" { context = "cwd://web" dockerfile = "Dockerfile" target = "final" tags = ["${REGISTRY}/-ui:${TAG}", "${REGISTRY}/-ui:latest"] cache-from = ["type=registry,ref=${REGISTRY}/-ui:buildcache"] cache-to = ["type=registry,ref=${REGISTRY}/-ui:buildcache,mode=max"] } target "migrate" { context = "cwd://api" dockerfile = "Dockerfile" target = "migrate-bundle" tags = ["-migrate-bundle:local"] cache-from = ["type=registry,ref=${REGISTRY}/-api:buildcache"] # no cache-to — api already exports this Dockerfile at mode=max }