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
{{ message }}
Repository navigation
Dockerfile should first copy requirements.txt and install dependencies before copying agent code #6923
In the current structure of the Dockerfile, the build first creates a layer with the agent's code, and then creates another layer with the installed dependencies. This order of operations causes the build process to re-create the dependencies layer after every code change, even if the list of dependencies in the requirements.txt hasn't changed.
The correct order should be:
copy only requirements.txt file.
run pip install to download dependencies
copy agent code
This should reduce the amount of time it takes to build container images when redeploying updated agent code, as long as the dependencies list doesn't change.
I'm preparing a focused fix for this issue: generate the Dockerfile by copying an agent's requirements.txt and installing those dependencies before copying the rest of the agent source, so source-only changes can reuse the dependency layer. I'll include a regression test that verifies the generated instruction order and will keep the change limited to the shared deployment template.
Thank you for raising this issue and sharing your suggestion, #6928 implements this and we would greatly appreciate your feedback on it.
We would also appreciate your inputs one edge case:
By copying requirements.txt before the main codebase, pip install step will fail if requirements file references a local file dependency since that code has not been copied into the container yet.
Hello @mikemikimike, Could you please share your inputs on above mentioned case as well?
Yes, I think this is a valid compatibility concern. The optimization should not make existing agent deployments fail. Since the previous Dockerfile copied the complete agent directory before running pip, local path/file dependencies could work there.
I suggest preserving the old copy-before-install order when requirements.txt contains a local path dependency, and using the cache-friendly order otherwise. Please add regression tests for both cases. If local file dependencies are intentionally unsupported by adk deploy, please confirm so this can be documented as a deliberate breaking change.
Activity
mikemikimike commentedon Aug 27, 2026
I'm preparing a focused fix for this issue: generate the Dockerfile by copying an agent's requirements.txt and installing those dependencies before copying the rest of the agent source, so source-only changes can reuse the dependency layer. I'll include a regression test that verifies the generated instruction order and will keep the change limited to the shared deployment template.
llalitkumarrr commentedon Sep 1, 2026
Hello @idofl,
Thank you for raising this issue and sharing your suggestion, #6928 implements this and we would greatly appreciate your feedback on it.
We would also appreciate your inputs one edge case:
By copying
requirements.txtbefore the main codebase,pip installstep will fail if requirements file references a local file dependency since that code has not been copied into the container yet.Hello @mikemikimike, Could you please share your inputs on above mentioned case as well?
mikemikimike commentedon Sep 1, 2026
Yes, I think this is a valid compatibility concern. The optimization should not make existing agent deployments fail. Since the previous Dockerfile copied the complete agent directory before running pip, local path/file dependencies could work there.
I suggest preserving the old copy-before-install order when requirements.txt contains a local path dependency, and using the cache-friendly order otherwise. Please add regression tests for both cases. If local file dependencies are intentionally unsupported by adk deploy, please confirm so this can be documented as a deliberate breaking change.
llalitkumarrr commentedon Sep 16, 2026
Hello @Jacksunwei,
Could you please take a look at this?