Skip to content

Commit 03e3090

Browse files
committed
feat(docker): add local compose setup for app and agent
- add docker-compose.yml to run the Next.js app and LangGraph agent together - add Dockerfile.agent for the Python agent container - wire the app container to the agent with LANGGRAPH_DEPLOYMENT_URL=http://agent:8123 - keep root .env usage consistent with langgraph.json - update README.md with Docker Compose run instructions and corrected env setup
1 parent 668c1b9 commit 03e3090

3 files changed

Lines changed: 68 additions & 3 deletions

File tree

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,32 @@ echo 'OPENAI_API_KEY=your-key' > apps/agent/.env
2828
pnpm dev
2929
```
3030

31-
- **App**: http://localhost:3000
32-
- **Agent**: http://localhost:8123
31+
- **App**: [http://localhost:3000](http://localhost:3000)
32+
- **Agent**: [http://localhost:8123](http://localhost:8123)
33+
34+
## Run with Docker Compose
35+
36+
```bash
37+
# Add your OpenAI API key at the repo root
38+
echo 'OPENAI_API_KEY=your-key' > .env
39+
40+
# Build and start the frontend + agent
41+
docker compose up --build
42+
```
43+
44+
- **App**: [http://localhost:3000](http://localhost:3000)
45+
- **Agent**: [http://localhost:8123](http://localhost:8123)
46+
47+
The Compose setup starts two services:
48+
49+
- `app` — Next.js frontend, configured to reach the agent at `http://agent:8123`
50+
- `agent` — LangGraph Python agent, using the root `.env` file mounted read-only at `/workspace/.env`
3351

3452
## Architecture
3553

3654
Turborepo monorepo with two apps:
3755

38-
```
56+
```text
3957
apps/
4058
├── app/ Next.js 16 frontend (CopilotKit v2, React 19, Tailwind 4)
4159
└── agent/ LangGraph Python agent (GPT-5.4, CopilotKit middleware)

docker-compose.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
services:
2+
agent:
3+
build:
4+
context: .
5+
dockerfile: docker/Dockerfile.agent
6+
env_file:
7+
- .env
8+
volumes:
9+
- ./.env:/workspace/.env:ro
10+
ports:
11+
- "8123:8123"
12+
13+
app:
14+
build:
15+
context: .
16+
dockerfile: docker/Dockerfile.app
17+
environment:
18+
LANGGRAPH_DEPLOYMENT_URL: http://agent:8123
19+
depends_on:
20+
- agent
21+
ports:
22+
- "3000:3000"

docker/Dockerfile.agent

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM python:3.12-slim
2+
3+
ENV PYTHONDONTWRITEBYTECODE=1
4+
ENV PYTHONUNBUFFERED=1
5+
6+
WORKDIR /workspace/apps/agent
7+
8+
RUN apt-get update \
9+
&& apt-get install -y --no-install-recommends nodejs npm build-essential \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
RUN pip install --no-cache-dir uv \
13+
&& npm install -g @langchain/langgraph-cli@1.1.12
14+
15+
COPY apps/agent/package.json ./package.json
16+
COPY apps/agent/pyproject.toml ./pyproject.toml
17+
COPY apps/agent/uv.lock ./uv.lock
18+
19+
RUN uv sync --frozen
20+
21+
COPY apps/agent/ ./
22+
23+
EXPOSE 8123
24+
25+
CMD ["langgraphjs", "dev", "--host", "0.0.0.0", "--port", "8123", "--no-browser"]

0 commit comments

Comments
 (0)