mirror of
https://github.com/tuna/tunasync.git
synced 2025-04-20 20:22:46 +00:00
fix(worker): keep the same working dir inside and outside of docker
This commit is contained in:
parent
9ffb101cc7
commit
d4e07a7b29
@ -32,6 +32,7 @@ func newDockerHook(p mirrorProvider, gCfg dockerConfig, mCfg mirrorConfig) *dock
|
|||||||
|
|
||||||
func (d *dockerHook) preExec() error {
|
func (d *dockerHook) preExec() error {
|
||||||
p := d.provider
|
p := d.provider
|
||||||
|
logDir := p.LogDir()
|
||||||
logFile := p.LogFile()
|
logFile := p.LogFile()
|
||||||
workingDir := p.WorkingDir()
|
workingDir := p.WorkingDir()
|
||||||
|
|
||||||
@ -42,17 +43,13 @@ func (d *dockerHook) preExec() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logFileNew := "/log_latest"
|
|
||||||
workingDirNew := "/data"
|
|
||||||
|
|
||||||
// Override workingDir
|
// Override workingDir
|
||||||
ctx := p.EnterContext()
|
ctx := p.EnterContext()
|
||||||
ctx.Set(_WorkingDirKey, workingDirNew)
|
|
||||||
ctx.Set(_LogFileKey+":docker", logFileNew)
|
|
||||||
ctx.Set(
|
ctx.Set(
|
||||||
"volumes", []string{
|
"volumes", []string{
|
||||||
fmt.Sprintf("%s:%s", logFile, logFileNew),
|
fmt.Sprintf("%s:%s", logDir, logDir),
|
||||||
fmt.Sprintf("%s:%s", workingDir, workingDirNew),
|
fmt.Sprintf("%s:%s", logFile, logFile),
|
||||||
|
fmt.Sprintf("%s:%s", workingDir, workingDir),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user