mirror of
https://github.com/docker/compose.git
synced 2025-07-22 21:24:38 +02:00
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"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
@ -246,7 +247,7 @@ func (s *composeService) toBuildOptions(project *types.Project, service types.Se
|
|||||||
return build.Options{
|
return build.Options{
|
||||||
Inputs: build.Inputs{
|
Inputs: build.Inputs{
|
||||||
ContextPath: service.Build.Context,
|
ContextPath: service.Build.Context,
|
||||||
DockerfilePath: filepath.Join(service.Build.Context, service.Build.Dockerfile),
|
DockerfilePath: dockerFilePath(service.Build.Context, service.Build.Dockerfile),
|
||||||
},
|
},
|
||||||
BuildArgs: buildArgs,
|
BuildArgs: buildArgs,
|
||||||
Tags: tags,
|
Tags: tags,
|
||||||
@ -285,3 +286,10 @@ func mergeArgs(m ...types.Mapping) types.Mapping {
|
|||||||
}
|
}
|
||||||
return merged
|
return merged
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func dockerFilePath(context string, dockerfile string) string {
|
||||||
|
if path.IsAbs(dockerfile) {
|
||||||
|
return dockerfile
|
||||||
|
}
|
||||||
|
return filepath.Join(context, dockerfile)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user