Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 9ace15c

Browse files
authored
Merge pull request #1439 from docker/build_url
Support build.context with git URLs
2 parents a86a473 + 4b1297e commit 9ace15c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

local/compose/build.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package compose
1919
import (
2020
"context"
2121
"fmt"
22+
"net/url"
2223
"os"
2324
"path"
2425
"strings"
@@ -190,11 +191,22 @@ func (s *composeService) toBuildOptions(service types.ServiceConfig, contextPath
190191
plats = append(plats, p)
191192
}
192193

193-
return build.Options{
194-
Inputs: build.Inputs{
194+
var input build.Inputs
195+
_, err := url.ParseRequestURI(service.Build.Context)
196+
if err == nil {
197+
input = build.Inputs{
198+
ContextPath: service.Build.Context,
199+
DockerfilePath: service.Build.Dockerfile,
200+
}
201+
} else {
202+
input = build.Inputs{
195203
ContextPath: path.Join(contextPath, service.Build.Context),
196204
DockerfilePath: path.Join(contextPath, service.Build.Context, service.Build.Dockerfile),
197-
},
205+
}
206+
}
207+
208+
return build.Options{
209+
Inputs: input,
198210
BuildArgs: flatten(mergeArgs(service.Build.Args, buildArgs)),
199211
Tags: tags,
200212
Target: service.Build.Target,

0 commit comments

Comments
 (0)