# State Hub Container Image

The State Hub production image is built from `state-hub/Dockerfile`.

## Build

```bash
cd state-hub
docker build --build-context hub_core_src=/home/worsch/hub-core \
  -t state-hub:local \
  -t forgejo.coulomb.social/coulomb/state-hub:<git-sha> .
```

The image installs runtime dependencies from `pyproject.toml` and excludes
workstation-local editable sources from registry resolution. `llm-connect` is
test-only and omitted. `hub-core` is runtime code and is installed from the
named `hub_core_src` Docker build context until it is published as a package.

## 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 Published Build

Verified and published on 2026-07-06:

```text
image: forgejo.coulomb.social/coulomb/state-hub:f2e042a
source commit: f2e042a
manifest digest: sha256:426c84de5b18c9e095e0efda5354ec73a52d77c45976649234a6e4f58b07d624
alembic heads: f0a1b2c3d4e5 (head)
cluster: coulombcore-k3s state-hub namespace, helm revision 2
```

Previous build (2026-06-25):

```text
image: forgejo.coulomb.social/coulomb/state-hub:b536741
source commit: b536741
local image id / index digest: sha256:3184dfd67f127cf8bd5303d7a210d6dc32e7ab05a5da5d51eab5b9a37dab4d4e
linux/amd64 manifest digest: sha256:a8f30b35c10d9c90fecf4e3ec82849ccb484b6c137cfce7948931005b9690377
config digest pulled by railiance01: sha256:5ce9c52fa554d6415e7d65d954e0778a8d8f7f8ebb5387c9e6694e1caac9b522
created: 2026-06-25T13:51:55+02:00
size: 106675605 bytes
alembic heads: e9f0a1b2c3d4 (head)
health: GET /state/health -> {"status":"ok","db":"connected"}
registry: docker push succeeded
railiance01: sudo crictl pull forgejo.coulomb.social/coulomb/state-hub:b536741 succeeded
```

Smoke command used a temporary container on host port 18082 so it did not
conflict with the live workstation State Hub on port 8000.

## Historical 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"}
```

## Registry

The registry target for CUST-WP-0011 is the self-hosted Gitea registry at
`forgejo.coulomb.social/coulomb/state-hub`. As of 2026-06-25, `/v2/` returns the
Docker Registry auth challenge and the `b536741` image tag has been pushed and
pulled from railiance01.
