Skip to content

Commit c95b271

Browse files
authored
docs: clarify .env configuration for Docker Compose deployment (#858)
- Expand Docker Compose section in README.md and README_zh.md with: - Explicit note that only root .env is used (not web/.env) - Instructions to update NEXT_PUBLIC_API_URL for remote/LAN deployment - Explanation that NEXT_PUBLIC_API_URL is a build-time variable - Improve NEXT_PUBLIC_API_URL comments in root .env.example Closes #527
1 parent 56b8c3a commit c95b271

3 files changed

Lines changed: 64 additions & 4 deletions

File tree

.env.example

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
DEBUG=True
55
APP_ENV=development
66

7-
# docker build args
7+
# Frontend API URL (used as Docker build arg for Next.js)
8+
# This is a BUILD-TIME variable: it gets embedded into the frontend JS bundle during build.
9+
# Default works for local development (localhost). For remote/LAN deployment, change to your host IP or domain:
10+
# NEXT_PUBLIC_API_URL=http://192.168.1.100:8000/api
11+
# NEXT_PUBLIC_API_URL=https://your-domain.com/api
12+
# Note: When using docker-compose, only this root .env is used (not web/.env).
13+
# If you change this value after building, you must rebuild: docker compose build
814
NEXT_PUBLIC_API_URL="http://localhost:8000/api"
915

1016
AGENT_RECURSION_LIMIT=30

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,34 @@ docker stop deer-flow-api-app
523523

524524
### Docker Compose (include both backend and frontend)
525525

526-
DeerFlow provides a docker-compose setup to easily run both the backend and frontend together:
526+
DeerFlow provides a docker-compose setup to easily run both the backend and frontend together.
527+
528+
#### Configuration
529+
530+
Before building, configure the root `.env` file (copied from `.env.example`):
531+
532+
```bash
533+
cp .env.example .env
534+
cp conf.yaml.example conf.yaml
535+
```
536+
537+
> [!IMPORTANT]
538+
> The `docker-compose.yml` only uses the **root `.env`** file (not `web/.env`). You do **not** need to create or modify `web/.env` when using Docker Compose.
539+
540+
If you are deploying on a **remote server** or accessing from a **LAN IP** (not `localhost`), you **must** update `NEXT_PUBLIC_API_URL` in the root `.env` to your actual host IP or domain:
541+
542+
```bash
543+
# Example: accessing from LAN IP
544+
NEXT_PUBLIC_API_URL=http://192.168.1.100:8000/api
545+
546+
# Example: remote deployment with domain
547+
NEXT_PUBLIC_API_URL=https://your-domain.com/api
548+
```
549+
550+
> [!NOTE]
551+
> `NEXT_PUBLIC_API_URL` is a **build-time** variable for Next.js — it gets embedded into the frontend JavaScript bundle during `docker compose build`. If you change this value later, you must rebuild with `docker compose build` for the change to take effect.
552+
553+
#### Build and Run
527554

528555
```bash
529556
# building docker image
@@ -534,7 +561,7 @@ docker compose up
534561
```
535562

536563
> [!WARNING]
537-
> If you want to deploy the deer flow into production environments, please add authentication to the website and evaluate your security check of the MCPServer and Python Repl.
564+
> If you want to deploy the deer flow into production environments, please add authentication to the website and evaluate your security check of the MCPServer and Python Repl.
538565
539566
## Examples
540567

README_zh.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,34 @@ docker stop deer-flow-api-app
476476

477477
### Docker Compose
478478

479-
您也可以使用 docker compose 设置此项目:
479+
您也可以使用 docker compose 同时运行后端和前端。
480+
481+
#### 配置
482+
483+
构建前,先配置根目录的 `.env` 文件(从 `.env.example` 复制):
484+
485+
```bash
486+
cp .env.example .env
487+
cp conf.yaml.example conf.yaml
488+
```
489+
490+
> [!IMPORTANT]
491+
> `docker-compose.yml` 只使用**根目录的 `.env`** 文件(不使用 `web/.env`)。使用 Docker Compose 时,您**不需要**创建或修改 `web/.env`
492+
493+
如果您在**远程服务器**上部署或通过**局域网 IP**(非 `localhost`)访问,**必须**将根目录 `.env` 中的 `NEXT_PUBLIC_API_URL` 修改为实际的主机 IP 或域名:
494+
495+
```bash
496+
# 示例:通过局域网 IP 访问
497+
NEXT_PUBLIC_API_URL=http://192.168.1.100:8000/api
498+
499+
# 示例:使用域名的远程部署
500+
NEXT_PUBLIC_API_URL=https://your-domain.com/api
501+
```
502+
503+
> [!NOTE]
504+
> `NEXT_PUBLIC_API_URL` 是 Next.js 的**构建时**变量——它会在 `docker compose build` 时被嵌入到前端 JavaScript 包中。如果之后修改了此值,必须重新执行 `docker compose build` 才能生效。
505+
506+
#### 构建和运行
480507

481508
```bash
482509
# 构建docker镜像

0 commit comments

Comments
 (0)