mirror of
https://github.com/moby/moby.git
synced 2025-07-29 07:21:35 +03:00
Set OS on scratch image and prevent panic if empty
Signed-off-by: John Stephens <johnstep@docker.com>
This commit is contained in:
@ -619,6 +619,28 @@ func testBuildWithSession(c *check.C, dir, dockerfile string) (outStr string) {
|
||||
return
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildScratchCopy(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerfile := `FROM scratch
|
||||
ADD Dockerfile /
|
||||
ENV foo bar`
|
||||
ctx := fakecontext.New(c, "",
|
||||
fakecontext.WithDockerfile(dockerfile),
|
||||
)
|
||||
defer ctx.Close()
|
||||
|
||||
res, body, err := request.Post(
|
||||
"/build",
|
||||
request.RawContent(ctx.AsTarReader(c)),
|
||||
request.ContentType("application/x-tar"))
|
||||
c.Assert(err, checker.IsNil)
|
||||
c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
|
||||
|
||||
out, err := request.ReadBody(body)
|
||||
require.NoError(c, err)
|
||||
assert.Contains(c, string(out), "Successfully built")
|
||||
}
|
||||
|
||||
type buildLine struct {
|
||||
Stream string
|
||||
Aux struct {
|
||||
|
Reference in New Issue
Block a user