builder: add an option for specifying build target#32496
Conversation
builder/dockerfile/imagecontext.go
Outdated
There was a problem hiding this comment.
Instead of this, how about
func (ic *imageContexts) isCurrentTarget(target string) string {
if target == "" {
return false
}
return strings.EqualFold(ic.currentName, target)
}That way the EqualFold is only done in one place.
cli/command/image/build.go
Outdated
There was a problem hiding this comment.
How about this for a description: "Exit after target build stage has completed".
The "default" is actually "", so it can probably be omitted.
There was a problem hiding this comment.
"Exit after target build stage has completed" is specific to current implementation. When the implementation changes in a future release, it should be invisible to the user, some cases just become faster.
Do you want me to skip the hint about default. I added it so that it is clear that passing this value is optional.
builder/dockerfile/builder.go
Outdated
There was a problem hiding this comment.
Can we use the command.From constant here? I believe the n.Value is already normalzied to lowercase.
20a2793 to
65aa584
Compare
|
@dnephin Updated. Lmk if you still prefer to tweak the usage message for the flag. |
builder/dockerfile/builder.go
Outdated
There was a problem hiding this comment.
I think this may still need the check for b.options.Target != "", right?
Signed-off-by: Tonis Tiigi <[email protected]>
65aa584 to
33e07f4
Compare
dnephin
left a comment
There was a problem hiding this comment.
I guess we can always fix the wording of the help flag later, so if the build is green, LGTM
cli/command/image/build.go
Outdated
There was a problem hiding this comment.
The current wording is just a bit ambiguous. On first reading I thought it was saying 'This flags sets the target build stage to the value of "build"'.
That doesn't really tell the user how the behaviour will change (target is what gets tagged, some context don't build, etc).
Maybe something like: "Name of the build-stage to build and optionally tag", "Build target build stage", or something like that?
|
LGTM |
builder: add an option for specifying build target
|
Is there an issue filed tracking this feature:
|
|
@cancan101 This is implemented in https://github.com/moby/buildkit/ , moby will get support with buildkit integration. |
fixes #32104
This is a first pass of
docker build --targetthat lets you specify an intermediate build stage that you wish to build/tag instead of the last one. The stages are still executed sequentially and only skipped from the end of the file if possible. Skipping other stages that do not have dependencies should be a future optimization that doesn't change the UI(cc @AkihiroSuda).@dnephin @vdemeester
Signed-off-by: Tonis Tiigi [email protected]