@@ -24,6 +24,7 @@ import (
2424 "github.com/docker/buildx/util/buildflags"
2525 "github.com/docker/buildx/util/platformutil"
2626 "github.com/docker/buildx/util/progress"
27+ "github.com/docker/buildx/util/urlutil"
2728 dockeropts "github.com/docker/cli/opts"
2829 hcl "github.com/hashicorp/hcl/v2"
2930 "github.com/moby/buildkit/client"
@@ -1302,7 +1303,7 @@ func updateContext(t *build.Inputs, inp *Input) {
13021303 if strings .HasPrefix (v .Path , "cwd://" ) || strings .HasPrefix (v .Path , "target:" ) || strings .HasPrefix (v .Path , "docker-image:" ) {
13031304 continue
13041305 }
1305- if build .IsRemoteURL (v .Path ) {
1306+ if urlutil .IsRemoteURL (v .Path ) {
13061307 continue
13071308 }
13081309 st := llb .Scratch ().File (llb .Copy (* inp .State , v .Path , "/" ), llb .WithCustomNamef ("set context %s to %s" , k , v .Path ))
@@ -1316,7 +1317,7 @@ func updateContext(t *build.Inputs, inp *Input) {
13161317 if strings .HasPrefix (t .ContextPath , "cwd://" ) {
13171318 return
13181319 }
1319- if build .IsRemoteURL (t .ContextPath ) {
1320+ if urlutil .IsRemoteURL (t .ContextPath ) {
13201321 return
13211322 }
13221323 st := llb .Scratch ().File (
@@ -1330,10 +1331,10 @@ func updateContext(t *build.Inputs, inp *Input) {
13301331}
13311332
13321333func isRemoteContext (t build.Inputs , inp * Input ) bool {
1333- if build .IsRemoteURL (t .ContextPath ) {
1334+ if urlutil .IsRemoteURL (t .ContextPath ) {
13341335 return true
13351336 }
1336- if inp != nil && build .IsRemoteURL (inp .URL ) && ! strings .HasPrefix (t .ContextPath , "cwd://" ) {
1337+ if inp != nil && urlutil .IsRemoteURL (inp .URL ) && ! strings .HasPrefix (t .ContextPath , "cwd://" ) {
13371338 return true
13381339 }
13391340 return false
@@ -1363,7 +1364,7 @@ func collectLocalPaths(t build.Inputs) []string {
13631364}
13641365
13651366func isLocalPath (p string ) (string , bool ) {
1366- if build .IsRemoteURL (p ) || strings .HasPrefix (p , "target:" ) || strings .HasPrefix (p , "docker-image:" ) {
1367+ if urlutil .IsRemoteURL (p ) || strings .HasPrefix (p , "target:" ) || strings .HasPrefix (p , "docker-image:" ) {
13671368 return "" , false
13681369 }
13691370 return strings .TrimPrefix (p , "cwd://" ), true
@@ -1381,7 +1382,7 @@ func toBuildOpt(t *Target, inp *Input) (*build.Options, error) {
13811382 if t .Context != nil {
13821383 contextPath = * t .Context
13831384 }
1384- if ! strings .HasPrefix (contextPath , "cwd://" ) && ! build .IsRemoteURL (contextPath ) {
1385+ if ! strings .HasPrefix (contextPath , "cwd://" ) && ! urlutil .IsRemoteURL (contextPath ) {
13851386 contextPath = path .Clean (contextPath )
13861387 }
13871388 dockerfilePath := "Dockerfile"
@@ -1411,7 +1412,7 @@ func toBuildOpt(t *Target, inp *Input) (*build.Options, error) {
14111412 if err != nil {
14121413 return nil , err
14131414 }
1414- } else if ! build .IsRemoteURL (bi .DockerfilePath ) && strings .HasPrefix (bi .ContextPath , "cwd://" ) && (inp != nil && build .IsRemoteURL (inp .URL )) {
1415+ } else if ! urlutil .IsRemoteURL (bi .DockerfilePath ) && strings .HasPrefix (bi .ContextPath , "cwd://" ) && (inp != nil && urlutil .IsRemoteURL (inp .URL )) {
14151416 // We don't currently support reading a remote Dockerfile with a local
14161417 // context when doing a remote invocation because we automatically
14171418 // derive the dockerfile from the context atm:
@@ -1433,7 +1434,7 @@ func toBuildOpt(t *Target, inp *Input) (*build.Options, error) {
14331434 if v , ok := strings .CutPrefix (bi .ContextPath , "cwd://" ); ok {
14341435 bi .ContextPath = path .Clean (v )
14351436 }
1436- if ! build .IsRemoteURL (bi .ContextPath ) && bi .ContextState == nil && ! filepath .IsAbs (bi .DockerfilePath ) {
1437+ if ! urlutil .IsRemoteURL (bi .ContextPath ) && bi .ContextState == nil && ! filepath .IsAbs (bi .DockerfilePath ) {
14371438 bi .DockerfilePath = filepath .Join (bi .ContextPath , bi .DockerfilePath )
14381439 }
14391440 for k , v := range bi .NamedContexts {
0 commit comments