New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builder: add an option for specifying build target #32496

Merged
merged 1 commit into from Apr 11, 2017

Conversation

Projects
None yet
6 participants
@tonistiigi
Member

tonistiigi commented Apr 10, 2017

fixes #32104

This is a first pass of docker build --target that 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 tonistiigi@gmail.com

Show outdated Hide outdated builder/dockerfile/imagecontext.go Outdated
Show outdated Hide outdated cli/command/image/build.go Outdated
Show outdated Hide outdated builder/dockerfile/builder.go Outdated
@tonistiigi

This comment has been minimized.

Show comment
Hide comment
@tonistiigi

tonistiigi Apr 10, 2017

Member

@dnephin Updated. Lmk if you still prefer to tweak the usage message for the flag.

Member

tonistiigi commented Apr 10, 2017

@dnephin Updated. Lmk if you still prefer to tweak the usage message for the flag.

Show outdated Hide outdated builder/dockerfile/builder.go Outdated
builder: add an option for specifying build target
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@dnephin

I guess we can always fix the wording of the help flag later, so if the build is green, LGTM

@@ -115,6 +116,7 @@ func NewBuildCommand(dockerCli *command.DockerCli) *cobra.Command {
flags.StringVar(&options.networkMode, "network", "default", "Set the networking mode for the RUN instructions during build")
flags.SetAnnotation("network", "version", []string{"1.25"})
flags.Var(&options.extraHosts, "add-host", "Add a custom host-to-IP mapping (host:ip)")
flags.StringVar(&options.target, "target", "", "Set the target build stage to build.")

This comment has been minimized.

@dnephin

dnephin Apr 10, 2017

Member

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?

@dnephin

dnephin Apr 10, 2017

Member

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?

@vieux vieux merged commit 18ae574 into moby:master Apr 11, 2017

5 of 6 checks passed

z Jenkins build Docker-PRs-s390x 1431 has failed
Details
dco-signed All commits are signed
experimental Jenkins build Docker-PRs-experimental 32800 has succeeded
Details
janky Jenkins build Docker-PRs 41410 has succeeded
Details
powerpc Jenkins build Docker-PRs-powerpc 1598 has succeeded
Details
windowsRS1 Jenkins build Docker-PRs-WoW-RS1 12541 has succeeded
Details

@GordonTheTurtle GordonTheTurtle added this to the 17.05.0 milestone Apr 11, 2017

@vieux

This comment has been minimized.

Show comment
Hide comment
@vieux

vieux Apr 11, 2017

Collaborator

LGTM

Collaborator

vieux commented Apr 11, 2017

LGTM

dnephin pushed a commit to dnephin/docker that referenced this pull request Apr 17, 2017

Merge pull request moby#32496 from tonistiigi/build-target
builder: add an option for specifying build target
@cancan101

This comment has been minimized.

Show comment
Hide comment
@cancan101

cancan101 Feb 28, 2018

Is there an issue filed tracking this feature:

Skipping other stages that do not have dependencies should be a future optimization that doesn't change the UI

cancan101 commented Feb 28, 2018

Is there an issue filed tracking this feature:

Skipping other stages that do not have dependencies should be a future optimization that doesn't change the UI

@tonistiigi

This comment has been minimized.

Show comment
Hide comment
@tonistiigi

tonistiigi Feb 28, 2018

Member

@cancan101 This is implemented in https://github.com/moby/buildkit/ , moby will get support with buildkit integration.

Member

tonistiigi commented Feb 28, 2018

@cancan101 This is implemented in https://github.com/moby/buildkit/ , moby will get support with buildkit integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment