feat: add Dockerfile and docker-compose.yml for the main Shogun (Tenshu)#20
Open
wstlima wants to merge 1 commit into
Open
feat: add Dockerfile and docker-compose.yml for the main Shogun (Tenshu)#20wstlima wants to merge 1 commit into
wstlima wants to merge 1 commit into
Conversation
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)
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.
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 forgensui/Dockerfile.Dockerfile
Multi-stage build:
node:20-alpine): buildsfrontend/(the Tenshu UI) — same asinstall.shstep 6python:3.12-slim): installs.[office](matchesinstall.shstep 4), installs the Mado browser engine (playwright install chromium), copies app code + built frontend, runs as a dedicated non-rootshogunuser (uid/gid 1000, same rationale as fix(gensui): run container as non-root user #19), exposes 8000Deliberately excludes the
[ronin]extra (desktop control) — it's interactive-only ininstall.sh(prompts y/N, needs X11 on Linux), not appropriate for an unattended container build.No manual
.envhandling needed:shogun/__main__.pyalready auto-generates.envfrom.env.example(or sensible defaults, includingAPI_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 asgensui/docker-compose.ymlin #15). Binds only to127.0.0.1:8000. Persists/app/data,/app/logs,/app/configs,/app/vaultin named volumes.Test plan
docker compose up -d --buildcompletes (multi-stage build, several minutes due to torch/transformers/playwright deps)0.0.0.0:8000GET /api/v1/health→{"service":"shogun","status":"ok","version":"1.6.15",...}GET /andGET /setup→ 200, frontend assets load correctlydocker exec shogun whoami→shogun(uid 1000, not root)