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