Open NotBad4U opened 6 years ago
Hi @NotBad4U, thanks for your feedback.
This is probably a missing feature in docker-java, since we delegate the build to BuildImageCmd
.
Just to add an update: I considered adding this in #1372 but this remains something that we'd need to add to docker-java first.
Is there a workaround for this one? Like using docker-compose instead? Also seems like target support was added already to docker java https://github.com/docker-java/docker-java/issues/1113
@trajano you can do something like this
static class CustomImageFromDockerfile extends ImageFromDockerfile {
@Override
protected void configure(BuildImageCmd buildImageCmd) {
super.configure(buildImageCmd);
buildImageCmd.withTarget("builder");
}
}
and then call new CustomImageFromDockerfile().withDockerfile(Paths.get("src/test/resources/Dockerfile-multistage"))
Hello, I'm using a container build from a Dockerfile with a multi-stage builds in my test:
And when I run my Junit test, the image build is the first stage of my multi-stage builds:
builder
. Do you have a way to declare whichtarget
stage I want for myImageFromDockerfile
?