mirror of https://github.com/docker/compose.git
use Dockerfile directly when path is absolute otherwise join it with Context path
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
This commit is contained in:
parent
8a9c4b52b4
commit
413f46ade0
|
@ -20,6 +20,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/compose-spec/compose-go/types"
|
||||
|
@ -246,7 +247,7 @@ func (s *composeService) toBuildOptions(project *types.Project, service types.Se
|
|||
return build.Options{
|
||||
Inputs: build.Inputs{
|
||||
ContextPath: service.Build.Context,
|
||||
DockerfilePath: filepath.Join(service.Build.Context, service.Build.Dockerfile),
|
||||
DockerfilePath: dockerFilePath(service.Build.Context, service.Build.Dockerfile),
|
||||
},
|
||||
BuildArgs: buildArgs,
|
||||
Tags: tags,
|
||||
|
@ -285,3 +286,10 @@ func mergeArgs(m ...types.Mapping) types.Mapping {
|
|||
}
|
||||
return merged
|
||||
}
|
||||
|
||||
func dockerFilePath(context string, dockerfile string) string {
|
||||
if path.IsAbs(dockerfile) {
|
||||
return dockerfile
|
||||
}
|
||||
return filepath.Join(context, dockerfile)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue