Merge pull request #937 from AkihiroSuda/rename-docker-connhelper
connhelper: docker -> docker-containerdocker-19.03
commit
5d13cca4a0
|
@ -1,26 +0,0 @@
|
|||
// Package connhelper provides helpers for connecting to a remote daemon host with custom logic.
|
||||
package connhelper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/cli/cli/connhelper/commandconn"
|
||||
"github.com/moby/buildkit/client/connhelper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
connhelper.Register("docker", DockerHelper)
|
||||
}
|
||||
|
||||
// DockerHelper returns helper for connecting to Docker container.
|
||||
// docker://<container> URL requires BuildKit v0.5.0 or later in the container.
|
||||
func DockerHelper(u *url.URL) (*connhelper.ConnectionHelper, error) {
|
||||
container := u.Host
|
||||
return &connhelper.ConnectionHelper{
|
||||
ContextDialer: func(ctx context.Context, addr string) (net.Conn, error) {
|
||||
return commandconn.New(ctx, "docker", "exec", "-i", container, "buildctl", "dial-stdio")
|
||||
},
|
||||
}, nil
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// Package dockercontainer provides connhelper for docker-container://<container>
|
||||
package dockercontainer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/cli/cli/connhelper/commandconn"
|
||||
"github.com/moby/buildkit/client/connhelper"
|
||||
)
|
||||
|
||||
func init() {
|
||||
connhelper.Register("docker-container", DockerContainerHelper)
|
||||
}
|
||||
|
||||
// DockerContainerHelper returns helper for connecting to Docker container.
|
||||
// docker-container://<container> URL requires BuildKit v0.5.0 or later in the container.
|
||||
func DockerContainerHelper(u *url.URL) (*connhelper.ConnectionHelper, error) {
|
||||
container := u.Host
|
||||
return &connhelper.ConnectionHelper{
|
||||
ContextDialer: func(ctx context.Context, addr string) (net.Conn, error) {
|
||||
return commandconn.New(ctx, "docker", "exec", "-i", container, "buildctl", "dial-stdio")
|
||||
},
|
||||
}, nil
|
||||
}
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
|
||||
_ "github.com/moby/buildkit/client/connhelper/docker"
|
||||
_ "github.com/moby/buildkit/client/connhelper/dockercontainer"
|
||||
bccommon "github.com/moby/buildkit/cmd/buildctl/common"
|
||||
"github.com/moby/buildkit/util/apicaps"
|
||||
"github.com/moby/buildkit/util/appdefaults"
|
||||
|
|
Loading…
Reference in New Issue