mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-07 02:07:52 +02:00
Add image arg to up command (#4385)
Using this argument, you can get more customization since you can do `langgraph build` or directly `docker build` your image and then re-use the `langgraph up --image my-image` and have it also spin up redis & postgres for you. Easier then writing your own compose file
This commit is contained in:
@@ -143,6 +143,8 @@ def compose_as_dict(
|
||||
debugger_base_url: Optional[str] = None,
|
||||
# postgres://user:password@host:port/database?option=value
|
||||
postgres_uri: Optional[str] = None,
|
||||
# If you are running against an already-built image, you can pass it here
|
||||
image: Optional[str] = None,
|
||||
) -> dict:
|
||||
"""Create a docker compose file as a dictionary in YML style."""
|
||||
if postgres_uri is None:
|
||||
@@ -211,6 +213,8 @@ def compose_as_dict(
|
||||
"POSTGRES_URI": postgres_uri,
|
||||
},
|
||||
}
|
||||
if image:
|
||||
services["langgraph-api"]["image"] = image
|
||||
|
||||
# If Postgres is included, add it to the dependencies of langgraph-api
|
||||
if include_db:
|
||||
@@ -244,6 +248,7 @@ def compose(
|
||||
debugger_base_url: Optional[str] = None,
|
||||
# postgres://user:password@host:port/database?option=value
|
||||
postgres_uri: Optional[str] = None,
|
||||
image: Optional[str] = None,
|
||||
) -> str:
|
||||
"""Create a docker compose file as a string."""
|
||||
compose_content = compose_as_dict(
|
||||
@@ -252,6 +257,7 @@ def compose(
|
||||
debugger_port=debugger_port,
|
||||
debugger_base_url=debugger_base_url,
|
||||
postgres_uri=postgres_uri,
|
||||
image=image,
|
||||
)
|
||||
compose_str = dict_to_yaml(compose_content)
|
||||
return compose_str
|
||||
|
||||
Reference in New Issue
Block a user