Skip to content

[Bug]: ImageFromDockerfileBuilder cannot build Dockerfile with intermediate layer (regression works with 3.3.0) #972

@jasdefer

Description

@jasdefer

Problem

I cannot give the docker directory to the ImageFromDockerfileBuilder, only the dockerfile is possible:

public ImageFromDockerfileBuilder WithDockerfile(string dockerfile)
    {
      return Merge(DockerResourceConfiguration, new ImageFromDockerfileConfiguration(dockerfile: dockerfile));
    }

I need to set the root to a certain directory so that the Copy instructions in my Dockerfile work.

Solution

I am not sure if this is enough, but consider this:

Add another method accepting the dockerfile and the directory.

public ImageFromDockerfileBuilder WithDockerfile(string dockerfile, string dockerfileDirectory)
    {
      return Merge(DockerResourceConfiguration, new ImageFromDockerfileConfiguration(dockerfile: dockerfile,
                                                                                     dockerfileDirectory: dockerfileDirectory));
    }

Benefit

This change could enable my use case for using the ImageFromDockerfileBuilder.

Alternatives

I am not sure if there are other alternatives, I don't understand Docker well enough yet.

Would you like to help contributing this enhancement?

Yes

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions