1
0
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:
John Stephens
2017-11-06 18:21:10 -08:00
parent b00b1b1c40
commit a97817b673
3 changed files with 39 additions and 2 deletions

View File

@ -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 {