@@ -18,6 +18,8 @@ import (
1818 "github.com/buildpacks/imgutil/remote"
1919 "github.com/buildpacks/lifecycle/platform"
2020
21+ "github.com/buildpacks/pack/internal/paths"
22+
2123 "github.com/docker/docker/api/types"
2224 "github.com/docker/docker/volume/mounts"
2325 "github.com/google/go-containerregistry/pkg/name"
@@ -320,6 +322,7 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error {
320322 return err
321323 }
322324 hostRunImagePath := filepath .Join (opts .LayoutConfig .LayoutRepoDir , targetRunImagePath )
325+ targetRunImagePath = filepath .Join (paths .RootDir , "layout-repo" , targetRunImagePath )
323326 fetchOptions .LayoutOption = image.LayoutOption {
324327 Path : hostRunImagePath ,
325328 Sparse : opts .LayoutConfig .Sparse ,
@@ -766,6 +769,7 @@ func (c *Client) processLayoutPath(inputImageRef, previousImageRef InputImageRef
766769 if err != nil {
767770 return layoutPathConfig {}, err
768771 }
772+ targetImagePath = filepath .Join (paths .RootDir , "layout-repo" , targetImagePath )
769773 c .logger .Debugf ("local image path %s will be mounted into the container at path %s" , hostImagePath , targetImagePath )
770774
771775 if previousImageRef .Name () != "" {
@@ -777,6 +781,7 @@ func (c *Client) processLayoutPath(inputImageRef, previousImageRef InputImageRef
777781 if err != nil {
778782 return layoutPathConfig {}, err
779783 }
784+ targetPreviousImagePath = filepath .Join (paths .RootDir , "layout-repo" , targetPreviousImagePath )
780785 c .logger .Debugf ("local previous image path %s will be mounted into the container at path %s" , hostPreviousImagePath , targetPreviousImagePath )
781786 }
782787 return layoutPathConfig {
@@ -1228,12 +1233,12 @@ func fullImagePath(inputImageRef InputImageReference, create bool) (string, erro
12281233// - The run-image path
12291234func appendLayoutVolumes (volumes []string , config layoutPathConfig ) []string {
12301235 if config .hostPreviousImagePath != "" {
1231- volumes = append (volumes , writableVolume (config .hostImagePath , config .targetImagePath ),
1232- readOnlyVolume (config .hostPreviousImagePath , config .targetPreviousImagePath ),
1233- readOnlyVolume (config .hostRunImagePath , config .targetRunImagePath ))
1236+ volumes = append (volumes , readOnlyVolume (config .hostPreviousImagePath , config .targetPreviousImagePath ),
1237+ readOnlyVolume (config .hostRunImagePath , config .targetRunImagePath ),
1238+ writableVolume (config .hostImagePath , config .targetImagePath ))
12341239 } else {
1235- volumes = append (volumes , writableVolume (config .hostImagePath , config .targetImagePath ),
1236- readOnlyVolume (config .hostRunImagePath , config .targetRunImagePath ))
1240+ volumes = append (volumes , readOnlyVolume (config .hostRunImagePath , config .targetRunImagePath ),
1241+ writableVolume (config .hostImagePath , config .targetImagePath ))
12371242 }
12381243 return volumes
12391244}
0 commit comments