Skip to content

Commit 70efab9

Browse files
committed
WIP: reduce buildx imports
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent d4fe20a commit 70efab9

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

pkg/compose/compose.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"sync"
2727

2828
"github.com/compose-spec/compose-go/v2/types"
29-
"github.com/docker/buildx/store/storeutil"
3029
"github.com/docker/cli/cli/command"
3130
"github.com/docker/cli/cli/config/configfile"
3231
"github.com/docker/cli/cli/flags"
@@ -250,7 +249,29 @@ func (s *composeService) getProxyConfig() map[string]string {
250249
if s.proxyConfig != nil {
251250
return s.proxyConfig
252251
}
253-
return storeutil.GetProxyConfig(s.dockerCli)
252+
cfg := s.dockerCli.ConfigFile()
253+
host := s.dockerCli.Client().DaemonHost()
254+
255+
proxy, ok := cfg.Proxies[host]
256+
if !ok {
257+
proxy = cfg.Proxies["default"]
258+
}
259+
260+
m := map[string]string{}
261+
262+
if v := proxy.HTTPProxy; v != "" {
263+
m["HTTP_PROXY"] = v
264+
}
265+
if v := proxy.HTTPSProxy; v != "" {
266+
m["HTTPS_PROXY"] = v
267+
}
268+
if v := proxy.NoProxy; v != "" {
269+
m["NO_PROXY"] = v
270+
}
271+
if v := proxy.FTPProxy; v != "" {
272+
m["FTP_PROXY"] = v
273+
}
274+
return m
254275
}
255276

256277
func (s *composeService) stdout() *streams.Out {

pkg/compose/pull.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import (
3030
"github.com/compose-spec/compose-go/v2/types"
3131
"github.com/containerd/platforms"
3232
"github.com/distribution/reference"
33-
"github.com/docker/buildx/driver"
3433
"github.com/docker/cli/cli/config/configfile"
34+
clitypes "github.com/docker/cli/cli/config/types"
3535
"github.com/moby/moby/api/types/jsonstream"
3636
"github.com/moby/moby/client"
3737
"github.com/opencontainers/go-digest"
@@ -272,7 +272,11 @@ func ImageDigestResolver(ctx context.Context, file *configfile.ConfigFile, apiCl
272272
}
273273
}
274274

275-
func encodedAuth(ref reference.Named, configFile driver.Auth) (string, error) {
275+
type Auth interface {
276+
GetAuthConfig(registryHostname string) (clitypes.AuthConfig, error)
277+
}
278+
279+
func encodedAuth(ref reference.Named, configFile Auth) (string, error) {
276280
authConfig, err := configFile.GetAuthConfig(registry.GetAuthConfigKey(reference.Domain(ref)))
277281
if err != nil {
278282
return "", err

0 commit comments

Comments
 (0)