mirror of https://github.com/docker/compose.git
resolve --env-file as absolute path
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
05e987dd0a
commit
d4a4dcf4ee
|
@ -187,13 +187,6 @@ func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn
|
||||||
return nil, compose.WrapComposeError(err)
|
return nil, compose.WrapComposeError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ef := o.EnvFile
|
|
||||||
if ef != "" && !filepath.IsAbs(ef) {
|
|
||||||
ef, err = filepath.Abs(ef)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for i, s := range project.Services {
|
for i, s := range project.Services {
|
||||||
s.CustomLabels = map[string]string{
|
s.CustomLabels = map[string]string{
|
||||||
api.ProjectLabel: project.Name,
|
api.ProjectLabel: project.Name,
|
||||||
|
@ -203,8 +196,8 @@ func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn
|
||||||
api.ConfigFilesLabel: strings.Join(project.ComposeFiles, ","),
|
api.ConfigFilesLabel: strings.Join(project.ComposeFiles, ","),
|
||||||
api.OneoffLabel: "False", // default, will be overridden by `run` command
|
api.OneoffLabel: "False", // default, will be overridden by `run` command
|
||||||
}
|
}
|
||||||
if ef != "" {
|
if o.EnvFile != "" {
|
||||||
s.CustomLabels[api.EnvironmentFileLabel] = ef
|
s.CustomLabels[api.EnvironmentFileLabel] = o.EnvFile
|
||||||
}
|
}
|
||||||
project.Services[i] = s
|
project.Services[i] = s
|
||||||
}
|
}
|
||||||
|
@ -250,7 +243,7 @@ func RunningAsStandalone() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// RootCommand returns the compose command with its child commands
|
// RootCommand returns the compose command with its child commands
|
||||||
func RootCommand(dockerCli command.Cli, backend api.Service) *cobra.Command {
|
func RootCommand(dockerCli command.Cli, backend api.Service) *cobra.Command { //nolint:gocyclo
|
||||||
// filter out useless commandConn.CloseWrite warning message that can occur
|
// filter out useless commandConn.CloseWrite warning message that can occur
|
||||||
// when using a remote context that is unreachable: "commandConn.CloseWrite: commandconn: failed to wait: signal: killed"
|
// when using a remote context that is unreachable: "commandConn.CloseWrite: commandconn: failed to wait: signal: killed"
|
||||||
// https://github.com/docker/cli/blob/e1f24d3c93df6752d3c27c8d61d18260f141310c/cli/connhelper/commandconn/commandconn.go#L203-L215
|
// https://github.com/docker/cli/blob/e1f24d3c93df6752d3c27c8d61d18260f141310c/cli/connhelper/commandconn/commandconn.go#L203-L215
|
||||||
|
@ -326,6 +319,12 @@ func RootCommand(dockerCli command.Cli, backend api.Service) *cobra.Command {
|
||||||
opts.ProjectDir = opts.WorkDir
|
opts.ProjectDir = opts.WorkDir
|
||||||
fmt.Fprint(os.Stderr, aec.Apply("option '--workdir' is DEPRECATED at root level! Please use '--project-directory' instead.\n", aec.RedF))
|
fmt.Fprint(os.Stderr, aec.Apply("option '--workdir' is DEPRECATED at root level! Please use '--project-directory' instead.\n", aec.RedF))
|
||||||
}
|
}
|
||||||
|
if opts.EnvFile != "" && !filepath.IsAbs(opts.EnvFile) {
|
||||||
|
opts.EnvFile, err = filepath.Abs(opts.EnvFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
if parallel > 0 {
|
if parallel > 0 {
|
||||||
backend.MaxConcurrency(parallel)
|
backend.MaxConcurrency(parallel)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue