You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all thank you for this great project. It works amazingly well.
Summary
Current behaviour: Using the --pre-archive flag only copies files if there are volumes configured.
Expected behaviour: Using the --pre-archive flag always copies files, if there are files available.
Context
The withFileSystemBind got deprecated and replaced with withCopyToContainer. As a result, most testcontainer module providers will therefore switch to using withCopyToContainer somewhere deep down in their file config helper methods, e.g.:
yourContainer = newContainerFromModule("someImage")
.withRamPercentage(75, 75) // some nice helper config function
.withRealmImportFile("/your-realm.json") // some file helper function which will use `withCopyToContainer` in the end
...
These config files must be copied to the container before it is started. It makes therefore sense to use the --pre-archive flag to get these files copied so that we can continue profiting from these useful upstream helper functions because otherwise the alternatives are:
Use the --pre-archive flag and replace the helper functions with your own manual withFileSystemBind calls: This is not nice because you will have to do all the work of the upstream helper functions manually. See also Copying a file to a container before starting it #53.
Do not use the --pre-archive flag and therefore kubedock will copy the files after the container has already started and therefore you need to wait for the files to be copied using a custom command/entrypoint (See also Copying a file to a container before starting it #53).
Use the --pre-archive flag and a manual existing bind mount as shown below as a current work around
Current Manual Workaround
Just add an existing Bind mount and the --pre-archive flag works as expected and you can continue using the upstream testcontainer module's helper functions, e.g.:
yourContainer = newContainerFromModule("someImage")
.withCreateContainerCmdModifier(
cmd ->
cmd.getHostConfig()
.withBinds
(
Bind.parse
(
System.getProperty("user.dir") + "/pom.xml:/tmp/pom.xml"// any manual existing bind will do
)
)
)
...
The text was updated successfully, but these errors were encountered:
First of all thank you for this great project. It works amazingly well.
Summary
--pre-archive
flag only copies files if there are volumes configured.--pre-archive
flag always copies files, if there are files available.Context
The
withFileSystemBind
got deprecated and replaced withwithCopyToContainer
. As a result, most testcontainer module providers will therefore switch to usingwithCopyToContainer
somewhere deep down in their file config helper methods, e.g.:These config files must be copied to the container before it is started. It makes therefore sense to use the
--pre-archive
flag to get these files copied so that we can continue profiting from these useful upstream helper functions because otherwise the alternatives are:withFileSystemBind
calls: This is not nice because you will have to do all the work of the upstream helper functions manually. See also Copying a file to a container before starting it #53.Current Manual Workaround
Just add an existing Bind mount and the --pre-archive flag works as expected and you can continue using the upstream testcontainer module's helper functions, e.g.:
The text was updated successfully, but these errors were encountered: