dockerfile: allow custom context names
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>docker-19.03
parent
8d6eaf6e39
commit
62697a93f7
|
@ -26,23 +26,25 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LocalNameContext = "context"
|
DefaultLocalNameContext = "context"
|
||||||
LocalNameDockerfile = "dockerfile"
|
DefaultLocalNameDockerfile = "dockerfile"
|
||||||
keyTarget = "target"
|
keyTarget = "target"
|
||||||
keyFilename = "filename"
|
keyFilename = "filename"
|
||||||
keyCacheFrom = "cache-from" // for registry only. deprecated in favor of keyCacheImports
|
keyCacheFrom = "cache-from" // for registry only. deprecated in favor of keyCacheImports
|
||||||
keyCacheImports = "cache-imports" // JSON representation of []CacheOptionsEntry
|
keyCacheImports = "cache-imports" // JSON representation of []CacheOptionsEntry
|
||||||
defaultDockerfileName = "Dockerfile"
|
defaultDockerfileName = "Dockerfile"
|
||||||
dockerignoreFilename = ".dockerignore"
|
dockerignoreFilename = ".dockerignore"
|
||||||
buildArgPrefix = "build-arg:"
|
buildArgPrefix = "build-arg:"
|
||||||
labelPrefix = "label:"
|
labelPrefix = "label:"
|
||||||
keyNoCache = "no-cache"
|
keyNoCache = "no-cache"
|
||||||
keyTargetPlatform = "platform"
|
keyTargetPlatform = "platform"
|
||||||
keyMultiPlatform = "multi-platform"
|
keyMultiPlatform = "multi-platform"
|
||||||
keyImageResolveMode = "image-resolve-mode"
|
keyImageResolveMode = "image-resolve-mode"
|
||||||
keyGlobalAddHosts = "add-hosts"
|
keyGlobalAddHosts = "add-hosts"
|
||||||
keyForceNetwork = "force-network-mode"
|
keyForceNetwork = "force-network-mode"
|
||||||
keyOverrideCopyImage = "override-copy-image" // remove after CopyOp implemented
|
keyOverrideCopyImage = "override-copy-image" // remove after CopyOp implemented
|
||||||
|
keyNameContext = "contextkey"
|
||||||
|
keyNameDockerfile = "dockerfilekey"
|
||||||
)
|
)
|
||||||
|
|
||||||
var httpPrefix = regexp.MustCompile("^https?://")
|
var httpPrefix = regexp.MustCompile("^https?://")
|
||||||
|
@ -54,6 +56,16 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) {
|
||||||
|
|
||||||
marshalOpts := []llb.ConstraintsOpt{llb.WithCaps(caps)}
|
marshalOpts := []llb.ConstraintsOpt{llb.WithCaps(caps)}
|
||||||
|
|
||||||
|
localNameContext := DefaultLocalNameContext
|
||||||
|
if v, ok := opts[keyNameContext]; ok {
|
||||||
|
localNameContext = v
|
||||||
|
}
|
||||||
|
|
||||||
|
localNameDockerfile := DefaultLocalNameDockerfile
|
||||||
|
if v, ok := opts[keyNameDockerfile]; ok {
|
||||||
|
localNameDockerfile = v
|
||||||
|
}
|
||||||
|
|
||||||
defaultBuildPlatform := platforms.DefaultSpec()
|
defaultBuildPlatform := platforms.DefaultSpec()
|
||||||
if workers := c.BuildOpts().Workers; len(workers) > 0 && len(workers[0].Platforms) > 0 {
|
if workers := c.BuildOpts().Workers; len(workers) > 0 && len(workers[0].Platforms) > 0 {
|
||||||
defaultBuildPlatform = workers[0].Platforms[0]
|
defaultBuildPlatform = workers[0].Platforms[0]
|
||||||
|
@ -100,19 +112,19 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) {
|
||||||
|
|
||||||
name := "load build definition from " + filename
|
name := "load build definition from " + filename
|
||||||
|
|
||||||
src := llb.Local(LocalNameDockerfile,
|
src := llb.Local(localNameDockerfile,
|
||||||
llb.FollowPaths([]string{filename}),
|
llb.FollowPaths([]string{filename}),
|
||||||
llb.SessionID(c.BuildOpts().SessionID),
|
llb.SessionID(c.BuildOpts().SessionID),
|
||||||
llb.SharedKeyHint(defaultDockerfileName),
|
llb.SharedKeyHint(localNameDockerfile),
|
||||||
dockerfile2llb.WithInternalName(name),
|
dockerfile2llb.WithInternalName(name),
|
||||||
)
|
)
|
||||||
var buildContext *llb.State
|
var buildContext *llb.State
|
||||||
isScratchContext := false
|
isScratchContext := false
|
||||||
if st, ok := detectGitContext(opts[LocalNameContext]); ok {
|
if st, ok := detectGitContext(opts[localNameContext]); ok {
|
||||||
src = *st
|
src = *st
|
||||||
buildContext = &src
|
buildContext = &src
|
||||||
} else if httpPrefix.MatchString(opts[LocalNameContext]) {
|
} else if httpPrefix.MatchString(opts[localNameContext]) {
|
||||||
httpContext := llb.HTTP(opts[LocalNameContext], llb.Filename("context"), dockerfile2llb.WithInternalName("load remote build context"))
|
httpContext := llb.HTTP(opts[localNameContext], llb.Filename("context"), dockerfile2llb.WithInternalName("load remote build context"))
|
||||||
def, err := httpContext.Marshal(marshalOpts...)
|
def, err := httpContext.Marshal(marshalOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to marshal httpcontext")
|
return nil, errors.Wrapf(err, "failed to marshal httpcontext")
|
||||||
|
@ -189,10 +201,10 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) {
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
dockerignoreState := buildContext
|
dockerignoreState := buildContext
|
||||||
if dockerignoreState == nil {
|
if dockerignoreState == nil {
|
||||||
st := llb.Local(LocalNameContext,
|
st := llb.Local(localNameContext,
|
||||||
llb.SessionID(c.BuildOpts().SessionID),
|
llb.SessionID(c.BuildOpts().SessionID),
|
||||||
llb.FollowPaths([]string{dockerignoreFilename}),
|
llb.FollowPaths([]string{dockerignoreFilename}),
|
||||||
llb.SharedKeyHint(dockerignoreFilename),
|
llb.SharedKeyHint(localNameContext+"-"+dockerignoreFilename),
|
||||||
dockerfile2llb.WithInternalName("load "+dockerignoreFilename),
|
dockerfile2llb.WithInternalName("load "+dockerignoreFilename),
|
||||||
)
|
)
|
||||||
dockerignoreState = &st
|
dockerignoreState = &st
|
||||||
|
|
|
@ -31,9 +31,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
emptyImageName = "scratch"
|
emptyImageName = "scratch"
|
||||||
localNameContext = "context"
|
defaultContextLocalName = "context"
|
||||||
historyComment = "buildkit.dockerfile.v0"
|
historyComment = "buildkit.dockerfile.v0"
|
||||||
|
|
||||||
DefaultCopyImage = "docker/dockerfile-copy:v0.1.9@sha256:e8f159d3f00786604b93c675ee2783f8dc194bb565e61ca5788f6a6e9d304061"
|
DefaultCopyImage = "docker/dockerfile-copy:v0.1.9@sha256:e8f159d3f00786604b93c675ee2783f8dc194bb565e61ca5788f6a6e9d304061"
|
||||||
)
|
)
|
||||||
|
@ -59,6 +59,7 @@ type ConvertOpt struct {
|
||||||
ForceNetMode pb.NetMode
|
ForceNetMode pb.NetMode
|
||||||
OverrideCopyImage string
|
OverrideCopyImage string
|
||||||
LLBCaps *apicaps.CapSet
|
LLBCaps *apicaps.CapSet
|
||||||
|
ContextLocalName string
|
||||||
}
|
}
|
||||||
|
|
||||||
func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, *Image, error) {
|
func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, *Image, error) {
|
||||||
|
@ -66,6 +67,10 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
|
||||||
return nil, nil, errors.Errorf("the Dockerfile cannot be empty")
|
return nil, nil, errors.Errorf("the Dockerfile cannot be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if opt.ContextLocalName == "" {
|
||||||
|
opt.ContextLocalName = defaultContextLocalName
|
||||||
|
}
|
||||||
|
|
||||||
platformOpt := buildPlatformOpt(&opt)
|
platformOpt := buildPlatformOpt(&opt)
|
||||||
|
|
||||||
optMetaArgs := getPlatformArgs(platformOpt)
|
optMetaArgs := getPlatformArgs(platformOpt)
|
||||||
|
@ -357,14 +362,14 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
|
||||||
opts := []llb.LocalOption{
|
opts := []llb.LocalOption{
|
||||||
llb.SessionID(opt.SessionID),
|
llb.SessionID(opt.SessionID),
|
||||||
llb.ExcludePatterns(opt.Excludes),
|
llb.ExcludePatterns(opt.Excludes),
|
||||||
llb.SharedKeyHint(localNameContext),
|
llb.SharedKeyHint(opt.ContextLocalName),
|
||||||
WithInternalName("load build context"),
|
WithInternalName("load build context"),
|
||||||
}
|
}
|
||||||
if includePatterns := normalizeContextPaths(ctxPaths); includePatterns != nil {
|
if includePatterns := normalizeContextPaths(ctxPaths); includePatterns != nil {
|
||||||
opts = append(opts, llb.FollowPaths(includePatterns))
|
opts = append(opts, llb.FollowPaths(includePatterns))
|
||||||
}
|
}
|
||||||
|
|
||||||
bc := llb.Local(localNameContext, opts...)
|
bc := llb.Local(opt.ContextLocalName, opts...)
|
||||||
if opt.BuildContext != nil {
|
if opt.BuildContext != nil {
|
||||||
bc = *opt.BuildContext
|
bc = *opt.BuildContext
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ RUN --mount=target=/context [ "$(cat /context/testfile)" == "contents0" ]
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
@ -44,8 +44,8 @@ RUN --mount=type=secret,mode=741,uid=100,gid=102,target=/mysecret [ "$(stat -c "
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
Session: []session.Attachable{secretsprovider.FromMap(map[string][]byte{
|
Session: []session.Attachable{secretsprovider.FromMap(map[string][]byte{
|
||||||
"mysecret": []byte("pw"),
|
"mysecret": []byte("pw"),
|
||||||
|
|
|
@ -72,8 +72,8 @@ RUN --mount=type=ssh,mode=741,uid=100,gid=102 [ "$(stat -c "%u %g %f" $SSH_AUTH_
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
Session: []session.Attachable{ssh},
|
Session: []session.Attachable{ssh},
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
|
@ -145,8 +145,8 @@ RUN [ "$(cat testfile)" == "contents0" ]
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -173,8 +173,8 @@ ENV foo bar
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -202,8 +202,8 @@ RUN [ "$(stat -c "%U %G" /dest)" == "user user" ]
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -238,8 +238,8 @@ COPY link/foo .
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -278,8 +278,8 @@ COPY --from=build /sub2/foo bar
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -310,8 +310,8 @@ RUN ["ls"]
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -347,8 +347,8 @@ COPY --from=build /out .
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
|
@ -391,8 +391,8 @@ COPY arch-$TARGETARCH whoami
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
FrontendAttrs: map[string]string{
|
FrontendAttrs: map[string]string{
|
||||||
"platform": "windows/amd64,linux/arm,linux/s390x",
|
"platform": "windows/amd64,linux/arm,linux/s390x",
|
||||||
|
@ -426,8 +426,8 @@ COPY arch-$TARGETARCH whoami
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
FrontendAttrs: map[string]string{
|
FrontendAttrs: map[string]string{
|
||||||
"platform": "windows/amd64,linux/arm/v6,linux/ppc64le",
|
"platform": "windows/amd64,linux/arm/v6,linux/ppc64le",
|
||||||
|
@ -514,8 +514,8 @@ COPY foo /
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -535,8 +535,8 @@ COPY foo /
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -567,8 +567,8 @@ COPY foo /
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -578,8 +578,8 @@ COPY foo /
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -620,8 +620,8 @@ COPY sub/l* alllinks/
|
||||||
|
|
||||||
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -712,8 +712,8 @@ CMD ["test"]
|
||||||
"name": target,
|
"name": target,
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -737,8 +737,8 @@ ENTRYPOINT my entrypoint
|
||||||
"name": target,
|
"name": target,
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -800,8 +800,8 @@ LABEL foo=bar
|
||||||
"name": target,
|
"name": target,
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -826,8 +826,8 @@ COPY foo .
|
||||||
"name": target,
|
"name": target,
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -875,8 +875,8 @@ COPY foo .
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -909,8 +909,8 @@ FROM busybox:${tag}
|
||||||
"build-arg:tag": "latest",
|
"build-arg:tag": "latest",
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1405,8 +1405,8 @@ EXPOSE 5000
|
||||||
"name": target,
|
"name": target,
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1491,8 +1491,8 @@ Dockerfile
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1546,8 +1546,8 @@ COPY . .
|
||||||
|
|
||||||
_, err = f.Solve(ctx, c, client.SolveOpt{
|
_, err = f.Solve(ctx, c, client.SolveOpt{
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
// err is either the expected error due to invalid dockerignore or error from the timeout
|
// err is either the expected error due to invalid dockerignore or error from the timeout
|
||||||
|
@ -1723,8 +1723,8 @@ USER nobody
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1745,8 +1745,8 @@ USER nobody
|
||||||
"name": target,
|
"name": target,
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1817,8 +1817,8 @@ COPY --from=base /out /
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1868,8 +1868,8 @@ COPY files dest
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1912,8 +1912,8 @@ COPY $FOO baz
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -1963,8 +1963,8 @@ COPY sub/dir1 subdest6
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -2187,8 +2187,8 @@ COPY --from=busybox /etc/passwd test
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -2221,8 +2221,8 @@ COPY --from=golang /usr/bin/go go
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -2262,8 +2262,8 @@ COPY --from=stage1 baz bax
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
FrontendAttrs: map[string]string{
|
FrontendAttrs: map[string]string{
|
||||||
"target": "Stage1",
|
"target": "Stage1",
|
||||||
|
@ -2307,8 +2307,8 @@ LABEL foo=bar
|
||||||
"name": target,
|
"name": target,
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -2396,8 +2396,8 @@ COPY --from=base unique /
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -2425,8 +2425,8 @@ COPY --from=base unique /
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -2476,8 +2476,8 @@ RUN echo bar > bar
|
||||||
"name": target,
|
"name": target,
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2568,8 +2568,8 @@ RUN echo bar > bar
|
||||||
"name": target,
|
"name": target,
|
||||||
},
|
},
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2638,8 +2638,8 @@ COPY --from=s1 unique2 /
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2721,8 +2721,8 @@ COPY foo2 bar2
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2772,8 +2772,8 @@ COPY --from=build out .
|
||||||
},
|
},
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2825,8 +2825,8 @@ COPY --from=build /out /
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2850,8 +2850,8 @@ COPY --from=build /out /
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2875,8 +2875,8 @@ COPY --from=build /out /
|
||||||
Exporter: client.ExporterLocal,
|
Exporter: client.ExporterLocal,
|
||||||
ExporterOutputDir: destDir,
|
ExporterOutputDir: destDir,
|
||||||
LocalDirs: map[string]string{
|
LocalDirs: map[string]string{
|
||||||
builder.LocalNameDockerfile: dir,
|
builder.DefaultLocalNameDockerfile: dir,
|
||||||
builder.LocalNameContext: dir,
|
builder.DefaultLocalNameContext: dir,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue