| 用途 | 声明式多目标构建 |
|---|---|
| 语法 | docker buildx bake [目标] [--push/--load] |
| 文件 | docker-bake.hcl / bake.json(默认自动查找) |
docker-bake.hcl 示例
docker-bake.hcl 示例
target "web" {
context = "."
dockerfile = "Dockerfile"
tags = ["registry.example.com/app/web:1.0"]
platforms = ["linux/amd64", "linux/arm64"]
}执行
执行
docker buildx bake --print # 先看解析后的构建设置
docker buildx bake --push公共配置可提取到 group/variable 复用;CI 与本地共用同一份 bake 文件减少环境差异。