In order to improve the cache mechanism, I've different steps when building my container.
In a previous step, I'm getting my composer.json like below so I can run composer install later on.
self.container = (
await self.container.
# [...]
.with_file(
"/app/src/composer.json",
self._stage.source_directory.file("composer.json"),
)
.sync()
)
Then I copy my entire codebase but I exclude the composer.json file:
filtered_source: Directory = self.source_directory.without_file(
"composer.json"
)
self.container = (
await self.container.terminal()
.with_mounted_directory("/app/src", filtered_source)
.terminal()
# [...]
.sync()
)
As you can see I'm starting two terminals, before and after the mount.
Before the mount: by doing a ls -al I can see my composer.json (and composer.lock) created earlier. Then I do the mount from my filtered source and, just after, in the second terminal, my composer.json file is no more there.
My expectation was : I exclude the file because I want to keep the file that was already in place.
Am I wrong? Thanks !