Skip to content

feat(docker): add Docker Compose deploy variant for the web app#607

Open
oliveres wants to merge 1 commit into
virattt:mainfrom
oliveres:feature/web-app-docker-compose
Open

feat(docker): add Docker Compose deploy variant for the web app#607
oliveres wants to merge 1 commit into
virattt:mainfrom
oliveres:feature/web-app-docker-compose

Conversation

@oliveres

Copy link
Copy Markdown

Closes #606.

Summary

  • Adds web-backend and web-frontend services to docker/docker-compose.yml under a new web profile, plus docker/Dockerfile.frontend (multi-stage Node build → nginx) and a minimal docker/nginx.conf with SPA fallback. Extends docker/README.md with a "Web Application (Docker Compose)" section.
  • web-backend reuses the existing ai-hedge-fund image without any changes to docker/Dockerfile or backend Python code. SQLite persistence uses a web_data named volume mounted at /app/data, with a runtime symlink in the service command: so the hardcoded path in app/backend/database/connection.py is respected.
  • Fixes a case-sensitive import in app/frontend/src/App.tsx (./components/layout./components/Layout). The actual file is Layout.tsx; the lowercase import resolves on case-insensitive filesystems (macOS APFS) but breaks the Vite build inside a Linux container. This is a pre-existing bug that blocks any Linux build of the frontend.

Build is scoped to the two web services explicitly because image: ai-hedge-fund is shared with the CLI services — letting Compose build all six in parallel via up --build would have them race to tag the same image. Likewise up names the services explicitly so the interactive CLI services in the default profile don't get started alongside the web stack.

Usage:

cd docker
docker compose build web-backend web-frontend
docker compose --profile web up -d web-backend web-frontend

Then http://localhost:5173 (UI) and http://localhost:8000/docs (API).

Test plan

  • docker compose build web-backend web-frontend succeeds; produces ai-hedge-fund and ai-hedge-fund-frontend images
  • docker compose --profile web up -d web-backend web-frontend starts only the two web containers (no CLI services running)
  • Frontend loads at http://localhost:5173 and successfully calls the backend (CORS allowed via the existing localhost:5173 whitelist in app/backend/main.py)
  • Backend Swagger UI loads at http://localhost:8000/docs
  • Creating and saving a flow in the UI persists across docker compose --profile web restart web-backend
  • Persistence survives full docker compose --profile web down + fresh up (named volume retained)
  • Existing CLI workflow (docker compose run hedge-fund … etc.) is unaffected — same ai-hedge-fund image, no changes to existing services

Files

Status File
modified app/frontend/src/App.tsx (case-sensitive import fix, 1 char)
modified docker/docker-compose.yml (+2 services, +1 named volume)
modified docker/README.md (new "Web Application" section)
new docker/Dockerfile.frontend
new docker/nginx.conf

docker/Dockerfile, all backend Python code, and all frontend source files (apart from the one-character case fix in App.tsx) are untouched.

Adds a web-backend and web-frontend service to docker/docker-compose.yml
under a `web` profile, plus a multi-stage docker/Dockerfile.frontend
(Node build -> nginx) and a minimal docker/nginx.conf with SPA fallback.

Both services build locally; no pre-built images are pulled. The
web-backend reuses the existing `ai-hedge-fund` image without any
changes to docker/Dockerfile or backend Python code. SQLite persistence
is achieved via a runtime symlink from /app/app/backend/hedge_fund.db
to a `web_data` named volume mounted at /app/data, created in the
service `command:` so the hardcoded path in connection.py is respected.

Also fixes a case-sensitive import in app/frontend/src/App.tsx
(`./components/layout` -> `./components/Layout`). The actual file is
Layout.tsx; the lowercase import resolved fine on case-insensitive
filesystems (macOS APFS) but broke the Vite build inside the Linux
container. This bug existed prior to this change and would block any
Linux build of the frontend.

Usage:

  cd docker
  docker compose build web-backend web-frontend
  docker compose --profile web up -d web-backend web-frontend

Open http://localhost:5173 (UI) and http://localhost:8000/docs (API).
Saved flows persist in the `web_data` named volume across restarts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Docker Compose deploy variant for the web application

1 participant