fix(cli): install agent deps before copying source in deploy Dockerfiles - #7181
Open
Anusha0501 wants to merge 1 commit into
Open
Anusha0501 wants to merge 1 commit into
Anusha0501 wants to merge 1 commit into
Conversation
Copying the full agent tree first made every source change rebuild the pip layer. Copy requirements.txt on its own, install, then copy the rest so Cloud Run, Agent Engine, and GKE keep the dependency cache. Fixes google#6923
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
adk deployDockerfiles copy the entire agent tree beforepip install -r requirements.txt. Any source-only change invalidates the dependency layer and re-downloads packages.Solution:
Copy
requirements.txtinto its own layer and install it before copying the rest of the agent. Cloud Run, Agent Engine, and GKE all share_DOCKERFILE_TEMPLATE, so the order is applied in one place. Agents withoutrequirements.txtstill emit the existing no-op comment.Testing Plan
Unit Tests:
Asserts that
COPY requirements.txtcomes beforeRUN pip installand that both come before the full agentCOPY.Manual End-to-End (E2E) Tests:
Generate a Cloud Run Dockerfile with
adk deploy cloud_runfor an agent that hasrequirements.txtand confirm the instruction order is: copy requirements, pip install, copy agent source.Checklist
Additional context
#6928 attempted the same cache-order fix and was closed unmerged. This reapplies it on current
_DOCKERFILE_TEMPLATEfor all three deploy targets.