Ver Fonte

[cli] update command: set default build context to dockerfile directory

Anukul Sangwan há 4 anos atrás
pai
commit
2a15e6e645
2 ficheiros alterados com 7 adições e 1 exclusões
  1. 1 1
      cli/cmd/deploy.go
  2. 6 0
      cli/cmd/deploy/deploy.go

+ 1 - 1
cli/cmd/deploy.go

@@ -234,7 +234,7 @@ func init() {
 		&localPath,
 		&localPath,
 		"path",
 		"path",
 		"p",
 		"p",
-		".",
+		"",
 		"If local build, the path to the build directory. If remote build, the relative path from the repository root to the build directory.",
 		"If local build, the path to the build directory. If remote build, the relative path from the repository root to the build directory.",
 	)
 	)
 
 

+ 6 - 0
cli/cmd/deploy/deploy.go

@@ -133,6 +133,12 @@ func NewDeployAgent(client *api.Client, app string, opts *DeployOpts) (*DeployAg
 		deployAgent.imageRepo = release.GitActionConfig.ImageRepoURI
 		deployAgent.imageRepo = release.GitActionConfig.ImageRepoURI
 	}
 	}
 
 
+	if deployAgent.opts.Method == DeployBuildTypeDocker {
+		if deployAgent.opts.LocalPath == "" {
+			deployAgent.opts.LocalPath = filepath.Dir(deployAgent.dockerfilePath)
+		}
+	}
+
 	deployAgent.tag = opts.OverrideTag
 	deployAgent.tag = opts.OverrideTag
 
 
 	return deployAgent, nil
 	return deployAgent, nil