Skip to content
Permalink
Browse files
feat(staged-dockerfile): initialize dockerfile-images with werf.yaml …
…configration section

refs #2215

Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed Oct 14, 2022
1 parent deb0827 commit 186f563fdfcea879032bb849fc907345ac6c7651
Showing 1 changed file with 9 additions and 7 deletions.
@@ -40,7 +40,7 @@ func MapDockerfileConfigToImagesSets(ctx context.Context, dockerfileImageConfig
return nil, fmt.Errorf("unable to parse dockerfile %s: %w", relDockerfilePath, err)
}

return mapDockerfileToImagesSets(ctx, d, opts)
return mapDockerfileToImagesSets(ctx, d, dockerfileImageConfig, opts)
}

img, err := mapLegacyDockerfileToImage(ctx, dockerfileImageConfig, opts)
@@ -55,7 +55,7 @@ func MapDockerfileConfigToImagesSets(ctx context.Context, dockerfileImageConfig
return ret, nil
}

func mapDockerfileToImagesSets(ctx context.Context, cfg *dockerfile.Dockerfile, opts CommonImageOptions) (ImagesSets, error) {
func mapDockerfileToImagesSets(ctx context.Context, cfg *dockerfile.Dockerfile, dockerfileImageConfig *config.ImageFromDockerfile, opts CommonImageOptions) (ImagesSets, error) {
var ret ImagesSets

stagesSets, err := cfg.GroupStagesByIndependentSets(ctx)
@@ -75,9 +75,10 @@ func mapDockerfileToImagesSets(ctx context.Context, cfg *dockerfile.Dockerfile,
// TODO parse FROM instruction properly, set correct BaseImageReference here

img, err := NewImage(ctx, "test", ImageFromRegistryAsBaseImage, ImageOptions{
IsDockerfileImage: true,
CommonImageOptions: opts,
BaseImageReference: "ubuntu:22.04",
IsDockerfileImage: true,
DockerfileImageConfig: dockerfileImageConfig,
CommonImageOptions: opts,
BaseImageReference: "ubuntu:22.04",
})
if err != nil {
return nil, fmt.Errorf("unable to create image %q: %w", "test", err)
@@ -98,8 +99,9 @@ func mapDockerfileToImagesSets(ctx context.Context, cfg *dockerfile.Dockerfile,

func mapLegacyDockerfileToImage(ctx context.Context, dockerfileImageConfig *config.ImageFromDockerfile, opts CommonImageOptions) (*Image, error) {
img, err := NewImage(ctx, dockerfileImageConfig.Name, NoBaseImage, ImageOptions{
CommonImageOptions: opts,
IsDockerfileImage: true,
CommonImageOptions: opts,
IsDockerfileImage: true,
DockerfileImageConfig: dockerfileImageConfig,
})
if err != nil {
return nil, fmt.Errorf("unable to create image %q: %w", dockerfileImageConfig.Name, err)

0 comments on commit 186f563

Please sign in to comment.