Files
state-hub/docs/container-image.md

73 lines
1.6 KiB
Markdown

# State Hub Container Image
The State Hub production image is built from `state-hub/Dockerfile`.
## Build
```bash
cd state-hub
docker build -t state-hub:local .
```
The image installs runtime dependencies from `pyproject.toml` and excludes the
local editable `llm-connect` dependency. `llm-connect` is currently used by the
test suite only; the API and MCP runtime do not import it. Removing that
workstation-local path from the image keeps cluster builds reproducible.
## Runtime
Required environment:
```bash
DATABASE_URL=postgresql+asyncpg://USER:PASSWORD@HOST:5432/DB
API_BASE=http://127.0.0.1:8000
```
The container starts:
```bash
uvicorn api.main:app --host 0.0.0.0 --port 8000
```
It includes Alembic migrations and can run migrations with:
```bash
docker run --rm --env DATABASE_URL=... state-hub:local alembic upgrade head
```
## Verification
After start, check:
```bash
curl http://127.0.0.1:8000/state/health
```
Expected response:
```json
{"status":"ok","db":"connected"}
```
## Current Local Build
Verified local build on 2026-05-15:
```text
image: state-hub:local
digest: sha256:039d29654ccb3754c6ecdbe497c6364bbd8452edcdcb7fa937dd9debf5b734ff
created: 2026-05-15T14:54:48+02:00
size: 106004480 bytes
alembic: t7o8p9q0r1s2 (head)
health: GET /state/health -> {"status":"ok","db":"connected"}
```
Smoke command used a temporary container on host port 18000 so it did not
conflict with the live workstation State Hub on port 8000.
## Registry
The registry target for CUST-WP-0011 is the self-hosted Gitea registry, but
publishing remains blocked until the Gitea package/container registry endpoint
is enabled and Docker can authenticate against `/v2/`.