do not ignore local build-contexts starting with "github.com"
| ... | ... |
@@ -157,12 +157,14 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
|
| 157 | 157 |
switch {
|
| 158 | 158 |
case specifiedContext == "-": |
| 159 | 159 |
buildCtx, relDockerfile, err = build.GetContextFromReader(dockerCli.In(), options.dockerfileName) |
| 160 |
+ case isLocalDir(specifiedContext): |
|
| 161 |
+ contextDir, relDockerfile, err = build.GetContextFromLocalDir(specifiedContext, options.dockerfileName) |
|
| 160 | 162 |
case urlutil.IsGitURL(specifiedContext): |
| 161 | 163 |
tempDir, relDockerfile, err = build.GetContextFromGitURL(specifiedContext, options.dockerfileName) |
| 162 | 164 |
case urlutil.IsURL(specifiedContext): |
| 163 | 165 |
buildCtx, relDockerfile, err = build.GetContextFromURL(progBuff, specifiedContext, options.dockerfileName) |
| 164 | 166 |
default: |
| 165 |
- contextDir, relDockerfile, err = build.GetContextFromLocalDir(specifiedContext, options.dockerfileName) |
|
| 167 |
+ return fmt.Errorf("unable to prepare context: path %q not found", specifiedContext)
|
|
| 166 | 168 |
} |
| 167 | 169 |
|
| 168 | 170 |
if err != nil {
|
| ... | ... |
@@ -357,6 +359,11 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
|
| 357 | 357 |
return nil |
| 358 | 358 |
} |
| 359 | 359 |
|
| 360 |
+func isLocalDir(c string) bool {
|
|
| 361 |
+ _, err := os.Stat(c) |
|
| 362 |
+ return err == nil |
|
| 363 |
+} |
|
| 364 |
+ |
|
| 360 | 365 |
type translatorFunc func(context.Context, reference.NamedTagged) (reference.Canonical, error) |
| 361 | 366 |
|
| 362 | 367 |
// validateTag checks if the given image name can be resolved. |