@@ -6,37 +6,29 @@ import (
6
6
7
7
"github.com/Sirupsen/logrus"
8
8
"github.com/docker/docker/api/types/backend"
9
- "github.com/docker/docker/api/types/container"
10
9
"github.com/docker/docker/builder"
11
10
"github.com/docker/docker/builder/remotecontext"
11
+ "github.com/docker/docker/layer"
12
12
"github.com/pkg/errors"
13
13
"golang.org/x/net/context"
14
14
)
15
15
16
16
type buildStage struct {
17
- id string
18
- config * container.Config
17
+ id string
19
18
}
20
19
21
- func newBuildStageFromImage ( image builder. Image ) * buildStage {
22
- return & buildStage {id : image . ImageID (), config : image . RunConfig () }
20
+ func newBuildStage ( imageID string ) * buildStage {
21
+ return & buildStage {id : imageID }
23
22
}
24
23
25
24
func (b * buildStage ) ImageID () string {
26
25
return b .id
27
26
}
28
27
29
- func (b * buildStage ) RunConfig () * container.Config {
30
- return b .config
31
- }
32
-
33
- func (b * buildStage ) update (imageID string , runConfig * container.Config ) {
28
+ func (b * buildStage ) update (imageID string ) {
34
29
b .id = imageID
35
- b .config = runConfig
36
30
}
37
31
38
- var _ builder.Image = & buildStage {}
39
-
40
32
// buildStages tracks each stage of a build so they can be retrieved by index
41
33
// or by name.
42
34
type buildStages struct {
@@ -48,12 +40,12 @@ func newBuildStages() *buildStages {
48
40
return & buildStages {byName : make (map [string ]* buildStage )}
49
41
}
50
42
51
- func (s * buildStages ) getByName (name string ) (builder. Image , bool ) {
43
+ func (s * buildStages ) getByName (name string ) (* buildStage , bool ) {
52
44
stage , ok := s .byName [strings .ToLower (name )]
53
45
return stage , ok
54
46
}
55
47
56
- func (s * buildStages ) get (indexOrName string ) (builder. Image , error ) {
48
+ func (s * buildStages ) get (indexOrName string ) (* buildStage , error ) {
57
49
index , err := strconv .Atoi (indexOrName )
58
50
if err == nil {
59
51
if err := s .validateIndex (index ); err != nil {
@@ -78,7 +70,7 @@ func (s *buildStages) validateIndex(i int) error {
78
70
}
79
71
80
72
func (s * buildStages ) add (name string , image builder.Image ) error {
81
- stage := newBuildStageFromImage (image )
73
+ stage := newBuildStage (image . ImageID () )
82
74
name = strings .ToLower (name )
83
75
if len (name ) > 0 {
84
76
if _ , ok := s .byName [name ]; ok {
@@ -90,8 +82,8 @@ func (s *buildStages) add(name string, image builder.Image) error {
90
82
return nil
91
83
}
92
84
93
- func (s * buildStages ) update (imageID string , runConfig * container. Config ) {
94
- s .sequence [len (s .sequence )- 1 ].update (imageID , runConfig )
85
+ func (s * buildStages ) update (imageID string ) {
86
+ s .sequence [len (s .sequence )- 1 ].update (imageID )
95
87
}
96
88
97
89
type getAndMountFunc func (string ) (builder.Image , builder.ReleaseableLayer , error )
@@ -190,3 +182,7 @@ func (im *imageMount) Image() builder.Image {
190
182
func (im * imageMount ) ImageID () string {
191
183
return im .image .ImageID ()
192
184
}
185
+
186
+ func (im * imageMount ) DiffID () layer.DiffID {
187
+ return im .layer .DiffID ()
188
+ }
0 commit comments