Implement build cache based on history array

Based on work by KJ Tsanaktsidis

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: KJ Tsanaktsidis <kjtsanaktsidis@gmail.com>
Upstream-commit: 690882c2e79c3f3742c709cf158584e61594ba00
Component: engine
This commit is contained in:
Tõnis Tiigi
2016-09-22 14:38:00 -07:00
committed by Tonis Tiigi
parent da06cf8da0
commit cc3c0d322a
13 changed files with 307 additions and 64 deletions

View File

@ -75,6 +75,8 @@ type Builder struct {
// TODO: remove once docker.Commit can receive a tag
id string
imageCache builder.ImageCache
}
// BuildManager implements builder.Backend and is shared across all Builder objects.
@ -136,6 +138,10 @@ func NewBuilder(clientCtx context.Context, config *types.ImageBuildOptions, back
LookingForDirectives: true,
},
}
if icb, ok := backend.(builder.ImageCacheBuilder); ok {
b.imageCache = icb.MakeImageCache(config.CacheFrom)
}
parser.SetEscapeToken(parser.DefaultEscapeToken, &b.directive) // Assume the default token for escape
if dockerfile != nil {