dockerfile: allow symlinks on reading Dockerfile
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>docker-18.09
parent
bf8c057e68
commit
2e3058e62c
|
@ -99,7 +99,7 @@ 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.IncludePatterns([]string{filename}),
|
llb.FollowPaths([]string{filename}),
|
||||||
llb.SessionID(c.BuildOpts().SessionID),
|
llb.SessionID(c.BuildOpts().SessionID),
|
||||||
llb.SharedKeyHint(defaultDockerfileName),
|
llb.SharedKeyHint(defaultDockerfileName),
|
||||||
dockerfile2llb.WithInternalName(name),
|
dockerfile2llb.WithInternalName(name),
|
||||||
|
@ -189,7 +189,7 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) {
|
||||||
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.IncludePatterns([]string{dockerignoreFilename}),
|
llb.FollowPaths([]string{dockerignoreFilename}),
|
||||||
llb.SharedKeyHint(dockerignoreFilename),
|
llb.SharedKeyHint(dockerignoreFilename),
|
||||||
dockerfile2llb.WithInternalName("load "+dockerignoreFilename),
|
dockerfile2llb.WithInternalName("load "+dockerignoreFilename),
|
||||||
)
|
)
|
||||||
|
|
|
@ -80,6 +80,7 @@ var allTests = []integration.Test{
|
||||||
testCopyThroughSymlinkMultiStage,
|
testCopyThroughSymlinkMultiStage,
|
||||||
testCopyChownCreateDest,
|
testCopyChownCreateDest,
|
||||||
testEmptyDestDir,
|
testEmptyDestDir,
|
||||||
|
testSymlinkedDockerfile,
|
||||||
}
|
}
|
||||||
|
|
||||||
var opts []integration.TestOpt
|
var opts []integration.TestOpt
|
||||||
|
@ -151,6 +152,34 @@ RUN [ "$(cat testfile)" == "contents0" ]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testSymlinkedDockerfile(t *testing.T, sb integration.Sandbox) {
|
||||||
|
f := getFrontend(t, sb)
|
||||||
|
|
||||||
|
dockerfile := []byte(`
|
||||||
|
FROM scratch
|
||||||
|
ENV foo bar
|
||||||
|
`)
|
||||||
|
|
||||||
|
dir, err := tmpdir(
|
||||||
|
fstest.CreateFile("Dockerfile.web", dockerfile, 0600),
|
||||||
|
fstest.Symlink("Dockerfile.web", "Dockerfile"),
|
||||||
|
)
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
|
c, err := client.New(context.TODO(), sb.Address())
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer c.Close()
|
||||||
|
|
||||||
|
_, err = f.Solve(context.TODO(), c, client.SolveOpt{
|
||||||
|
LocalDirs: map[string]string{
|
||||||
|
builder.LocalNameDockerfile: dir,
|
||||||
|
builder.LocalNameContext: dir,
|
||||||
|
},
|
||||||
|
}, nil)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
func testCopyChownCreateDest(t *testing.T, sb integration.Sandbox) {
|
func testCopyChownCreateDest(t *testing.T, sb integration.Sandbox) {
|
||||||
f := getFrontend(t, sb)
|
f := getFrontend(t, sb)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue