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

Commit fd067a7

Browse files
authored
Merge pull request #406 from mikeparker/fix-attachments
Fix attachments on deploy by switching the working directory
2 parents e2d9fa3 + 448765e commit fd067a7

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

cmd/docker-app/deploy.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package main
22

33
import (
4+
"os"
5+
46
"github.com/docker/app/internal"
57
"github.com/docker/app/internal/packager"
68
"github.com/docker/app/render"
@@ -75,6 +77,11 @@ func runDeploy(dockerCli command.Cli, flags *pflag.FlagSet, appname string, opts
7577
if stackName == "" {
7678
stackName = internal.AppNameFromDir(app.Name)
7779
}
80+
if app.Source.ShouldRunInsideDirectory() {
81+
if err := os.Chdir(app.Path); err != nil {
82+
return err
83+
}
84+
}
7885
return stack.RunDeploy(dockerCli, flags, rendered, deployOrchestrator, options.Deploy{
7986
Namespace: stackName,
8087
ResolveImage: swarm.ResolveImageAlways,

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)