Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use ImageFromDockerfile with deleteOnExit=false #739

Open
oboudet-beetween opened this issue Dec 7, 2024 · 2 comments
Open

Allow to use ImageFromDockerfile with deleteOnExit=false #739

oboudet-beetween opened this issue Dec 7, 2024 · 2 comments
Labels
is:enhancement New feature or request

Comments

@oboudet-beetween
Copy link

Is your feature request related to a problem? Please describe.

I have an image which is relatively slow to build. I would like to use docker cache for the many layers my image have.
TestContainers allows to set deleteOnExit to false, but i don't see a way to set it whith microshed-testcontainers.

@oboudet-beetween oboudet-beetween added the is:enhancement New feature or request label Dec 7, 2024
@KyleAure
Copy link
Collaborator

KyleAure commented Dec 9, 2024

@oboudet-beetween Thanks for your suggestion.

I assume you are referring to the ApplicationContainer class which has the following logic:

} else if (dockerfile.isPresent()) {
if (!Files.exists(dockerfile.get()))
throw new ExtensionConfigurationException("Dockerfile did not exist at: " + dockerfile.get());
ImageFromDockerfile image = new ImageFromDockerfile("testcontainers/mpapp-" + Base58.randomString(10).toLowerCase());
image.withDockerfile(dockerfile.get());
image.setBaseDirectory(Paths.get("."));
return image;

Where we should have a builder method like withDeleteOnExit(boolean delete)
And then set the deleteOnExit parameter of the ImageFromDockerfile instance.

I think this would be a great enhancement. If you are interested I would be happy to accept a pull request to add this enhancement. Otherwise, I can work on getting it added as I have time.

@oboudet-beetween
Copy link
Author

Thanks for your feedback, you are right, I am talking about ApplicationContainer.
I can try to send you a PR when I will have some time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants