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

Support mounting host file/directory to devservices containers #37684

Closed
Eng-Fouad opened this issue Dec 12, 2023 · 5 comments · Fixed by #36508
Closed

Support mounting host file/directory to devservices containers #37684

Eng-Fouad opened this issue Dec 12, 2023 · 5 comments · Fixed by #36508
Labels
Milestone

Comments

@Eng-Fouad
Copy link
Contributor

Description

Testcontainers has API to copy/mount file/directory to containers:

continer.withCopyFileToContainer(MountableFile.forHostPath("/mappable-resource/"), directoryInContainer);

See: Testcontainers for Java: Files and volumes


One possible usage is to add Keycloak extension to Keycloak devservices by copying the extension jar files to /opt/keycloak/providers.

Implementation ideas

It can be added to app configurations, something like:

quarkus.keycloak.devservices.mount=./extension/jars:/opt/keycloak/providers
@Eng-Fouad Eng-Fouad added the kind/enhancement New feature or request label Dec 12, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 12, 2023

/cc @geoand (devservices), @stuartwdouglas (devservices)

@geoand
Copy link
Contributor

geoand commented Dec 12, 2023

I think it makes sense. WDYT @sberyozkin?

@sberyozkin
Copy link
Member

sberyozkin commented Dec 12, 2023

@geoand Sure, makes sense

@Eng-Fouad As far as the Keycloak dev service is concerned,

FYI, in this PR, https://github.com/quarkusio/quarkus/pull/36508/files#diff-67404a43520250b1ebd5a0c945e070e60d70d4a3ba06b15e3fac747f820320ccR541

I'm attempting to attach a specific classpath or file system file to a required container location (there, a generated policy jar has to be copied), can that help with your requirements ? Note I'm using 2 maps there, one creates aliases to the local resources, another maps these aliases to container locations - I'm not 100% sure having a single Map to map for ex a Windows path to the container resource can work without resorting to various escape tricks...

@Eng-Fouad
Copy link
Contributor Author

@geoand Sure, makes sense

@Eng-Fouad As far as the Keycloak dev service is concerned,

FYI, in this PR, https://github.com/quarkusio/quarkus/pull/36508/files#diff-67404a43520250b1ebd5a0c945e070e60d70d4a3ba06b15e3fac747f820320ccR541

I'm attempting to attach a specific classpath or file system file to a required container location (there, a generated policy jar has to be copied), can that help with your requirements ? Note I'm using 2 maps there, one creates aliases to the local resources, another maps these aliases to container locations - I'm not 100% sure having a single Map to map for ex a Windows path to the container resource can work without resorting to various escape tricks...

Yes, this seems what I am looking for.

@sberyozkin
Copy link
Member

sberyozkin commented Dec 14, 2023

@Eng-Fouad OK, thanks, let me have that PR fix this issue on its completion.
I guess we will be easily able to map the whole directories if it will be necessary as a follow up to that PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants