Add support for `RUN [""]` in Dockerfiles for greater specificity in what is actually executed
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
This commit is contained in:
parent
7985125602
commit
fd78128870
|
@ -124,7 +124,7 @@ func (b *buildFile) CmdRun(args string) error {
|
||||||
if b.image == "" {
|
if b.image == "" {
|
||||||
return fmt.Errorf("Please provide a source image with `from` prior to run")
|
return fmt.Errorf("Please provide a source image with `from` prior to run")
|
||||||
}
|
}
|
||||||
config, _, _, err := ParseRun([]string{b.image, "/bin/sh", "-c", args}, nil)
|
config, _, _, err := ParseRun(append([]string{b.image}, b.buildCmdFromJson(args)...), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,31 @@ run [ "$(cat /bar/withfile)" = "test2" ]
|
||||||
},
|
},
|
||||||
nil,
|
nil,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// JSON!
|
||||||
|
{
|
||||||
|
`
|
||||||
|
FROM {IMAGE}
|
||||||
|
RUN ["/bin/echo","hello","world"]
|
||||||
|
CMD ["/bin/true"]
|
||||||
|
ENTRYPOINT ["/bin/echo","your command -->"]
|
||||||
|
`,
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
`
|
||||||
|
FROM {IMAGE}
|
||||||
|
ADD test /test
|
||||||
|
RUN ["chmod","+x","/test"]
|
||||||
|
RUN ["/test"]
|
||||||
|
RUN [ "$(cat /testfile)" = 'test!' ]
|
||||||
|
`,
|
||||||
|
[][2]string{
|
||||||
|
{"test", "#!/bin/sh\necho 'test!' > /testfile"},
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: test building with 2 successive overlapping ADD commands
|
// FIXME: test building with 2 successive overlapping ADD commands
|
||||||
|
|
Loading…
Reference in New Issue