Alexander Belanger 4 лет назад
Родитель
Сommit
c15e185f4a
5 измененных файлов с 10 добавлено и 2 удалено
  1. 1 0
      cli/cmd/deploy.go
  2. 2 0
      cli/cmd/deploy/build.go
  3. 1 0
      cli/cmd/deploy/shared.go
  4. 1 0
      cli/cmd/docker/builder.go
  5. 5 2
      cli/cmd/pack/pack.go

+ 1 - 0
cli/cmd/deploy.go

@@ -460,6 +460,7 @@ func updateGetAgent(client *api.Client) (*deploy.DeployAgent, error) {
 			OverrideTag:     tag,
 			Method:          buildMethod,
 			AdditionalEnv:   additionalEnv,
+			UseCache:        useCache,
 		},
 		Local: source != "github",
 	})

+ 2 - 0
cli/cmd/deploy/build.go

@@ -49,6 +49,7 @@ func (b *BuildAgent) BuildDocker(
 		Env:               b.env,
 		DockerfilePath:    dockerfilePath,
 		IsDockerfileInCtx: isDockerfileInCtx,
+		UseCache:          b.UseCache,
 	}
 
 	return dockerAgent.BuildLocal(
@@ -78,6 +79,7 @@ func (b *BuildAgent) BuildPack(dockerAgent *docker.Agent, dst, tag, prevTag stri
 		Tag:          tag,
 		BuildContext: dst,
 		Env:          b.env,
+		UseCache:     b.UseCache,
 	}
 
 	// call builder

+ 1 - 0
cli/cmd/deploy/shared.go

@@ -19,6 +19,7 @@ type SharedOpts struct {
 	Method          DeployBuildType
 	AdditionalEnv   map[string]string
 	EnvGroups       []types.EnvGroupMeta
+	UseCache        bool
 }
 
 func coalesceEnvGroups(

+ 1 - 0
cli/cmd/docker/builder.go

@@ -25,6 +25,7 @@ type BuildOpts struct {
 	BuildContext      string
 	DockerfilePath    string
 	IsDockerfileInCtx bool
+	UseCache          bool
 
 	Env map[string]string
 }

+ 5 - 2
cli/cmd/pack/pack.go

@@ -43,8 +43,11 @@ func (a *Agent) Build(opts *docker.BuildOpts, buildConfig *types.BuildConfig, dc
 		Builder:         "paketobuildpacks/builder:full",
 		AppPath:         opts.BuildContext,
 		Env:             opts.Env,
-		CacheImage:      cacheImage,
-		Publish:         true,
+	}
+
+	if opts.UseCache {
+		buildOpts.CacheImage = cacheImage
+		buildOpts.Publish = true
 	}
 
 	if buildConfig != nil {