Merge pull request #30411 from thaJeztah/fix-build-from-local-github-directories

do not ignore local build-contexts starting with "github.com"
This commit is contained in:
Alexander Morozov 2017-01-31 12:45:11 -08:00 коммит произвёл GitHub
Родитель 0fbff69ab0 37a1a84d91
Коммит 048fc98c09
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -157,12 +157,14 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
switch {
case specifiedContext == "-":
buildCtx, relDockerfile, err = build.GetContextFromReader(dockerCli.In(), options.dockerfileName)
case isLocalDir(specifiedContext):
contextDir, relDockerfile, err = build.GetContextFromLocalDir(specifiedContext, options.dockerfileName)
case urlutil.IsGitURL(specifiedContext):
tempDir, relDockerfile, err = build.GetContextFromGitURL(specifiedContext, options.dockerfileName)
case urlutil.IsURL(specifiedContext):
buildCtx, relDockerfile, err = build.GetContextFromURL(progBuff, specifiedContext, options.dockerfileName)
default:
contextDir, relDockerfile, err = build.GetContextFromLocalDir(specifiedContext, options.dockerfileName)
return fmt.Errorf("unable to prepare context: path %q not found", specifiedContext)
}
if err != nil {
@ -357,6 +359,11 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
return nil
}
func isLocalDir(c string) bool {
_, err := os.Stat(c)
return err == nil
}
type translatorFunc func(context.Context, reference.NamedTagged) (reference.Canonical, error)
// validateTag checks if the given image name can be resolved.