TradingAgents-astock/docker-compose.yml
Simon Lin fa8839e944 feat(docker): 补 Web UI compose 服务,并说明 tradingagents-web 入口
镜像 ENTRYPOINT 只有 CLI,compose 里没有任何 Web UI 服务,用户要在容器里
跑看板只能自己拼命令,常写成依赖 CWD 的 `streamlit run web/app.py`,工作
目录不对就报 File does not exist(issue #82)。

- compose 新增 web 服务:entrypoint 用 tradingagents-web(web.launch:main
  按 __file__ 解析 app.py 绝对路径,与 CWD 无关),映射 8501
- 通过 STREAMLIT_SERVER_ADDRESS=0.0.0.0 让容器内监听全地址,否则端口映射进不来
  (已实测 streamlit config show 确认三个环境变量均生效)
- README FAQ 增加对应条目

Reported-by: @Labear33
2026-07-26 17:42:41 +12:00

57 lines
1.4 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

services:
# CLI默认docker compose run --rm tradingagents
tradingagents:
build: .
env_file:
- .env
volumes:
- tradingagents_data:/home/appuser/.tradingagents
tty: true
stdin_open: true
# Web UIdocker compose up web → http://localhost:8501
#
# 入口用 `tradingagents-web`= web.launch:main它按 __file__ 解析 app.py 的
# 绝对路径,与工作目录无关。不要写成 `streamlit run web/app.py`——那条依赖 CWD
# 一旦工作目录不对就报 "File does not exist: web/app.py"issue #82
web:
build: .
entrypoint: ["tradingagents-web"]
env_file:
- .env
environment:
# 容器内必须监听 0.0.0.0,否则端口映射进不来
- STREAMLIT_SERVER_ADDRESS=0.0.0.0
- STREAMLIT_SERVER_PORT=8501
- STREAMLIT_SERVER_HEADLESS=true
ports:
- "8501:8501"
volumes:
- tradingagents_data:/home/appuser/.tradingagents
ollama:
image: ollama/ollama:latest
volumes:
- ollama_data:/root/.ollama
profiles:
- ollama
tradingagents-ollama:
build: .
env_file:
- .env
environment:
- LLM_PROVIDER=ollama
volumes:
- tradingagents_data:/home/appuser/.tradingagents
depends_on:
- ollama
tty: true
stdin_open: true
profiles:
- ollama
volumes:
tradingagents_data:
ollama_data: