feat(docker): add Docker Compose deploy variant for the web app#607
Open
oliveres wants to merge 1 commit into
Open
feat(docker): add Docker Compose deploy variant for the web app#607oliveres wants to merge 1 commit into
oliveres wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #606.
Summary
web-backendandweb-frontendservices todocker/docker-compose.ymlunder a newwebprofile, plusdocker/Dockerfile.frontend(multi-stage Node build → nginx) and a minimaldocker/nginx.confwith SPA fallback. Extendsdocker/README.mdwith a "Web Application (Docker Compose)" section.web-backendreuses the existingai-hedge-fundimage without any changes todocker/Dockerfileor backend Python code. SQLite persistence uses aweb_datanamed volume mounted at/app/data, with a runtime symlink in the servicecommand:so the hardcoded path inapp/backend/database/connection.pyis respected.app/frontend/src/App.tsx(./components/layout→./components/Layout). The actual file isLayout.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-fundis shared with the CLI services — letting Compose build all six in parallel viaup --buildwould have them race to tag the same image. Likewiseupnames 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-frontendThen http://localhost:5173 (UI) and http://localhost:8000/docs (API).
Test plan
docker compose build web-backend web-frontendsucceeds; producesai-hedge-fundandai-hedge-fund-frontendimagesdocker compose --profile web up -d web-backend web-frontendstarts only the two web containers (no CLI services running)localhost:5173whitelist inapp/backend/main.py)docker compose --profile web restart web-backenddocker compose --profile web down+ freshup(named volume retained)docker compose run hedge-fund …etc.) is unaffected — sameai-hedge-fundimage, no changes to existing servicesFiles
app/frontend/src/App.tsx(case-sensitive import fix, 1 char)docker/docker-compose.yml(+2 services, +1 named volume)docker/README.md(new "Web Application" section)docker/Dockerfile.frontenddocker/nginx.confdocker/Dockerfile, all backend Python code, and all frontend source files (apart from the one-character case fix inApp.tsx) are untouched.