Skip to content

Commit 9932015

Browse files
Jacksunweicopybara-github
authored andcommitted
chore: Makes --host backward compatible for cloud_run deploy. --host only available after 0.5.0.
PiperOrigin-RevId: 760681697
1 parent 3f11739 commit 9932015

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/google/adk/cli/cli_deploy.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
5555
EXPOSE {port}
5656
57-
CMD adk {command} --port={port} --host=0.0.0.0 {session_db_option} {trace_to_cloud_option} "/app/agents"
57+
CMD adk {command} --port={port} {host_option} {session_db_option} {trace_to_cloud_option} "/app/agents"
5858
"""
5959

6060

@@ -141,6 +141,7 @@ def to_cloud_run(
141141

142142
# create Dockerfile
143143
click.echo('Creating Dockerfile...')
144+
host_option = '--host=0.0.0.0' if adk_version > '0.5.0' else ''
144145
dockerfile_content = _DOCKERFILE_TEMPLATE.format(
145146
gcp_project_id=project,
146147
gcp_region=region,
@@ -153,6 +154,7 @@ def to_cloud_run(
153154
else '',
154155
trace_to_cloud_option='--trace_to_cloud' if trace_to_cloud else '',
155156
adk_version=adk_version,
157+
host_option=host_option,
156158
)
157159
dockerfile_path = os.path.join(temp_folder, 'Dockerfile')
158160
os.makedirs(temp_folder, exist_ok=True)

0 commit comments

Comments
 (0)