chore(docker): split REST/A2A and MCP into separate services

master
oabrivard 6 days ago
parent 54da3efdc9
commit 8bfe6c518f

@ -20,6 +20,6 @@ COPY typings ./typings
RUN uv sync --frozen --no-dev RUN uv sync --frozen --no-dev
RUN mkdir -p /app/data RUN mkdir -p /app/data
EXPOSE 8000 EXPOSE 8000 8001
CMD [".venv/bin/uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] CMD [".venv/bin/uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

@ -59,10 +59,15 @@ uv run uvicorn app.main:app --reload
### Docker ### Docker
```bash ```bash
docker compose up --build -d docker compose up --build -d personal-agent personal-agent-mcp
docker compose logs -f docker compose logs -f personal-agent personal-agent-mcp
``` ```
Docker endpoints:
- REST + A2A API: `http://127.0.0.1:8000`
- MCP streamable HTTP: `http://127.0.0.1:8001/mcp`
Container mounts: Container mounts:
- `./${GOOGLE_CLIENT_SECRETS_FILE}` -> `/app/${GOOGLE_CLIENT_SECRETS_FILE}` (read-only) - `./${GOOGLE_CLIENT_SECRETS_FILE}` -> `/app/${GOOGLE_CLIENT_SECRETS_FILE}` (read-only)
@ -137,6 +142,8 @@ Run MCP on a dedicated port:
uv run uvicorn app.mcp_main:app --host 0.0.0.0 --port 8001 uv run uvicorn app.mcp_main:app --host 0.0.0.0 --port 8001
``` ```
With Docker Compose, MCP is provided by the `personal-agent-mcp` service.
MCP streamable HTTP endpoint: MCP streamable HTTP endpoint:
```text ```text

@ -7,6 +7,7 @@ services:
restart: unless-stopped restart: unless-stopped
env_file: env_file:
- .env - .env
command: [".venv/bin/uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
ports: ports:
- "8000:8000" - "8000:8000"
volumes: volumes:
@ -18,3 +19,24 @@ services:
interval: 30s interval: 30s
timeout: 5s timeout: 5s
retries: 3 retries: 3
personal-agent-mcp:
build:
context: .
dockerfile: Dockerfile
container_name: personal-agent-mcp
restart: unless-stopped
env_file:
- .env
command: [".venv/bin/uvicorn", "app.mcp_main:app", "--host", "0.0.0.0", "--port", "8001"]
ports:
- "8001:8001"
volumes:
- ./${GOOGLE_CLIENT_SECRETS_FILE:-credentials.json}:/app/${GOOGLE_CLIENT_SECRETS_FILE:-credentials.json}:ro
- ./${GOOGLE_TOKEN_FILE:-token.json}:/app/${GOOGLE_TOKEN_FILE:-token.json}
- ./data:/app/data
healthcheck:
test: ["CMD", "python", "-c", "import socket;s=socket.create_connection(('127.0.0.1',8001),2);s.close()"]
interval: 30s
timeout: 5s
retries: 3

Loading…
Cancel
Save