Bake: allow inheriting from a map
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 682
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 29
Description
Description
Playing around with Docker Bake I found I needed to duplicate quite a bit of config as currently
https://github.com/docker/buildx/issues/1203 is not yet supported. However, even with that feature implemented, it would
be nice to inherit config from a map like, for example:
function "mkTarget" {
params = [name]
result = {
tags = ["registry.example.com/${name}"]
cache-from = [
{
type = "registry"
ref = "registry.example.com/${name}:cache"
}
]
cache-to = [
{
type = "registry"
ref = "registry.example.com/${name}:cache"
}
]
}
}
target "default" {
inherits = [mkTarget("app")]
context = "something"
tags = ["registry.example.com/other:latest"]
}
This probably shouldn't use the inherits field, but this is just to give a general idea. It should probably not be
possible to merge the contents of the inherits field in the map due to potential infinite loops.
I'd be happy to look into implementing this if this is something that would be useful.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Docker Bake's handling of HCL functions, target inheritance, and map values, then review the related buildx issue #1203. Define how a target can inherit configuration from a function-returned map and ensure merging the map's inherits field cannot create infinite loops.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- build-system, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100