Skip to content

Commit

Permalink
fix(worker): keep the same working dir inside and outside of docker
Browse files Browse the repository at this point in the history
  • Loading branch information
bigeagle committed Dec 18, 2016
1 parent 9ffb101 commit d4e07a7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions worker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func newDockerHook(p mirrorProvider, gCfg dockerConfig, mCfg mirrorConfig) *dock

func (d *dockerHook) preExec() error {
p := d.provider
logDir := p.LogDir()
logFile := p.LogFile()
workingDir := p.WorkingDir()

Expand All @@ -42,17 +43,13 @@ func (d *dockerHook) preExec() error {
}
}

logFileNew := "/log_latest"
workingDirNew := "/data"

// Override workingDir
ctx := p.EnterContext()
ctx.Set(_WorkingDirKey, workingDirNew)
ctx.Set(_LogFileKey+":docker", logFileNew)
ctx.Set(
"volumes", []string{
fmt.Sprintf("%s:%s", logFile, logFileNew),
fmt.Sprintf("%s:%s", workingDir, workingDirNew),
fmt.Sprintf("%s:%s", logDir, logDir),
fmt.Sprintf("%s:%s", logFile, logFile),
fmt.Sprintf("%s:%s", workingDir, workingDir),
},
)
return nil
Expand Down

0 comments on commit d4e07a7

Please sign in to comment.