mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-12 14:37:08 +08:00
build: avoid resolution of dockerfile if context is remote
In 566f41b598
, we added a check to ensure
that we avoid resolving http URLs for Dockerfile. However, we have
another circumstance we should not resolve the path in - if the context
is a remote context, the dockerfile is resolved in that context (see
build.go#LoadInputs for more information).
Therefore, we should only resolve the dockerfile to a local directory if
the context is also resolved to a local directory.
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
@ -42,13 +42,18 @@ func TestResolvePaths(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "dockerfilename",
|
||||
options: controllerapi.BuildOptions{DockerfileName: "test"},
|
||||
want: controllerapi.BuildOptions{DockerfileName: filepath.Join(tmpwd, "test")},
|
||||
options: controllerapi.BuildOptions{DockerfileName: "test", ContextPath: "."},
|
||||
want: controllerapi.BuildOptions{DockerfileName: filepath.Join(tmpwd, "test"), ContextPath: tmpwd},
|
||||
},
|
||||
{
|
||||
name: "dockerfilename-dash",
|
||||
options: controllerapi.BuildOptions{DockerfileName: "-"},
|
||||
want: controllerapi.BuildOptions{DockerfileName: "-"},
|
||||
options: controllerapi.BuildOptions{DockerfileName: "-", ContextPath: "."},
|
||||
want: controllerapi.BuildOptions{DockerfileName: "-", ContextPath: tmpwd},
|
||||
},
|
||||
{
|
||||
name: "dockerfilename-remote",
|
||||
options: controllerapi.BuildOptions{DockerfileName: "test", ContextPath: "git@github.com:docker/buildx.git"},
|
||||
want: controllerapi.BuildOptions{DockerfileName: "test", ContextPath: "git@github.com:docker/buildx.git"},
|
||||
},
|
||||
{
|
||||
name: "contexts",
|
||||
|
Reference in New Issue
Block a user