Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 448765e

Browse files
author
Mike Parker
committed
Only change directory to the dir if we're using an image file format that actually uses a directory
Signed-off-by: Mike Parker <michael.parker@docker.com>
1 parent ff3fd5b commit 448765e

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

cmd/docker-app/deploy.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ func runDeploy(dockerCli command.Cli, flags *pflag.FlagSet, appname string, opts
7777
if stackName == "" {
7878
stackName = internal.AppNameFromDir(app.Name)
7979
}
80-
if err := os.Chdir(app.Path); err != nil {
81-
return err
80+
if app.Source.ShouldRunInsideDirectory() {
81+
if err := os.Chdir(app.Path); err != nil {
82+
return err
83+
}
8284
}
8385
return stack.RunDeploy(dockerCli, flags, rendered, deployOrchestrator, options.Deploy{
8486
Namespace: stackName,

types/types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ const (
3232
AppSourceArchive
3333
)
3434

35+
// ShouldRunInsideDirectory returns whether the package is run from a directory on disk
36+
func (a AppSourceKind) ShouldRunInsideDirectory() bool {
37+
return a == AppSourceSplit || a == AppSourceImage || a == AppSourceArchive
38+
}
39+
3540
// App represents an app
3641
type App struct {
3742
Name string

0 commit comments

Comments
 (0)