Skip to content

feat: add Dockerfile and docker-compose.yml for the main Shogun (Tenshu)#20

Open
wstlima wants to merge 1 commit into
AlphaHorizon-AI:mainfrom
wstlima:feat/shogun-dockerfile-compose
Open

feat: add Dockerfile and docker-compose.yml for the main Shogun (Tenshu)#20
wstlima wants to merge 1 commit into
AlphaHorizon-AI:mainfrom
wstlima:feat/shogun-dockerfile-compose

Conversation

@wstlima

@wstlima wstlima commented Jul 10, 2026

Copy link
Copy Markdown

Fixes #11

Summary

The repo has a Dockerfile for gensui/ but none for the main Shogun app — install.sh (venv-based, runs on the host) is the only documented install path. This adds a container option, following the same pattern already used for gensui/Dockerfile.

Dockerfile

Multi-stage build:

  • Stage 1 (node:20-alpine): builds frontend/ (the Tenshu UI) — same as install.sh step 6
  • Stage 2 (python:3.12-slim): installs .[office] (matches install.sh step 4), installs the Mado browser engine (playwright install chromium), copies app code + built frontend, runs as a dedicated non-root shogun user (uid/gid 1000, same rationale as fix(gensui): run container as non-root user #19), exposes 8000

Deliberately excludes the [ronin] extra (desktop control) — it's interactive-only in install.sh (prompts y/N, needs X11 on Linux), not appropriate for an unattended container build.

No manual .env handling needed: shogun/__main__.py already auto-generates .env from .env.example (or sensible defaults, including API_HOST=0.0.0.0/API_PORT=8000) on first run if missing, and auto-bootstraps the database.

docker-compose.yml

Force-added past .gitignore (same situation as gensui/docker-compose.yml in #15). Binds only to 127.0.0.1:8000. Persists /app/data, /app/logs, /app/configs, /app/vault in named volumes.

Test plan

  • docker compose up -d --build completes (multi-stage build, several minutes due to torch/transformers/playwright deps)
  • Container boots cleanly: auto-bootstrap creates all tables, seeds 20 Samurai Roles, 5 security policies, initializes Qdrant, starts uvicorn on 0.0.0.0:8000
  • GET /api/v1/health{"service":"shogun","status":"ok","version":"1.6.15",...}
  • GET / and GET /setup → 200, frontend assets load correctly
  • docker exec shogun whoamishogun (uid 1000, not root)

The repo has a Dockerfile for gensui/ but none for the main Shogun
app — install.sh (venv-based, runs on the host) is the only
documented install path. This adds a container option, following the
same pattern already used for gensui/Dockerfile.

## Dockerfile
Multi-stage build:
- Stage 1 (node:20-alpine): builds frontend/ (the Tenshu UI) — same
  as install.sh step 6 (`cd frontend && npm install && npm run build`)
- Stage 2 (python:3.12-slim): installs `.[office]` (matches
  install.sh step 4's `pip install ".[office]"`), installs the Mado
  browser engine (`playwright install chromium`, matching step 4's
  optional install), copies app code + built frontend, runs as a
  dedicated non-root `shogun` user (uid/gid 1000, same rationale as
  the gensui/Dockerfile non-root fix), exposes 8000.

Deliberately excludes the `[ronin]` extra (desktop control) — it's
interactive-only in install.sh (prompts y/N, needs X11 on Linux),
not appropriate for an unattended container build.

No manual .env handling needed: shogun/__main__.py already
auto-generates `.env` from `.env.example` (or sensible defaults,
including `API_HOST=0.0.0.0`/`API_PORT=8000`) on first run if
missing, and auto-bootstraps the database — verified this works
correctly running as the non-root user, since /app is chowned to it
before USER switches.

## docker-compose.yml
Force-added past .gitignore (same situation as gensui/docker-compose.yml
— already gitignored upstream, presumably meant to be
deployer-provided). Binds only to 127.0.0.1:8000. Persists
/app/data, /app/logs, /app/configs, /app/vault in named volumes.

## Test plan
- [x] `docker compose up -d --build` completes (multi-stage build,
      several minutes due to torch/transformers/playwright deps)
- [x] Container boots cleanly: auto-bootstrap creates all tables,
      seeds 20 Samurai Roles, 5 security policies, initializes
      Qdrant, starts uvicorn on 0.0.0.0:8000
- [x] `GET /api/v1/health` → `{"service":"shogun","status":"ok","version":"1.6.15",...}`
- [x] `GET /` and `GET /setup` → 200, frontend assets load correctly
- [x] `docker exec shogun whoami` → `shogun` (uid 1000, not root)
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.

No Dockerfile/docker-compose.yml for the main Shogun app (Tenshu)

1 participant