如何自定义Dockerfile¶
用户可以在从父LangGraph镜像导入后,在Dockerfile中添加一系列额外的行。为此,您只需通过向dockerfile_lines
键传递要运行的命令来修改您的langgraph.json
文件即可。例如,如果我们希望在图中使用Pillow
,则需要添加以下依赖项:
{
"dependencies": ["."],
"graphs": {
"openai_agent": "./openai_agent.py:agent",
},
"env": "./.env",
"dockerfile_lines": [
"RUN apt-get update && apt-get install -y libjpeg-dev zlib1g-dev libpng-dev",
"RUN pip install Pillow"
]
}
这将安装用于处理jpeg
或png
图像格式所需的系统包。