mirror of
https://github.com/docker/cli.git
synced 2026-10-13 01:14:40 -04:00
Move build endpoint handler from daemon (#21972)
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Upstream-commit: 73ac6d199cacbcdba4c062f982b31f8d57e03f3c Component: engine
This commit is contained in:
committed by
David Calavera
parent
6761133f09
commit
4447d74a76
@@ -1,33 +0,0 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types/backend"
|
||||
"github.com/docker/docker/builder"
|
||||
"github.com/docker/docker/builder/dockerfile"
|
||||
"github.com/docker/engine-api/types"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// BuildFromContext builds a new image from a given context.
|
||||
func (daemon *Daemon) BuildFromContext(ctx context.Context, src io.ReadCloser, remote string, buildOptions *types.ImageBuildOptions, pg backend.ProgressWriter) (string, error) {
|
||||
buildContext, dockerfileName, err := builder.DetectContextFromRemoteURL(src, remote, pg.ProgressReaderFunc)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer func() {
|
||||
if err := buildContext.Close(); err != nil {
|
||||
logrus.Debugf("[BUILDER] failed to remove temporary context: %v", err)
|
||||
}
|
||||
}()
|
||||
if len(dockerfileName) > 0 {
|
||||
buildOptions.Dockerfile = dockerfileName
|
||||
}
|
||||
|
||||
m := dockerfile.NewBuildManager(daemon)
|
||||
return m.Build(ctx, buildOptions,
|
||||
builder.DockerIgnoreContext{ModifiableContext: buildContext},
|
||||
pg.StdoutFormatter, pg.StderrFormatter, pg.Output)
|
||||
}
|
||||
Reference in New Issue
Block a user