README: how to publish the release images to Docker Hub
release gate / check (push) Failing after 6m57s

DevOps asked for the create/import path from the Gitea repo. Documents
both routes: Option A, the tag-triggered Gitea Actions release workflow
(smoke-gated publish; prerequisites: act_runner + DOCKERHUB_USERNAME/
DOCKERHUB_TOKEN secrets), and Option B, a fully manual buildx build+push
from a clone of the tag — including the one-time builder/qemu setup, a
migrate-image smoke test mirroring the CI gate, exact contexts and files
for all three images, and the shared-tag + latest convention. Plus the
post-publish step: bump VERSION in deploy/federated/service so the house
upgrade flow picks releases up. Records the constraints learned while
building this: semver without v prefix (VERSION_RX), never move a pushed
tag, keep the repos public for anonymous pulls, arm64 web builds are the
slow qemu step, and the app Dockerfile must stay legacy-builder
compatible.
This commit is contained in:
Andrew S Erwin
2026-10-29 14:27:10 -05:00
parent d914a87e98
commit fc9b6c2c42
+91
View File
@@ -407,6 +407,97 @@ detects an empty database, applies `schema.sql` as the superbrain user,
then runs the checksummed migration ledger — the host never needs the
source tree.
## Publishing release images (Docker Hub)
Releases are three multi-arch images sharing **one semver tag without a `v`
prefix** (the suite's `VERSION_RX` is `^[0-9][0-9\.]*$`), plus `:latest`:
```
federatedcomputer/superbrain-app:<version> Go API (context ., Dockerfile)
federatedcomputer/superbrain-web:<version> Next.js UI (context web, web/Dockerfile)
federatedcomputer/superbrain-migrate:<version> DB bootstrap (context db, db/Dockerfile)
```
Platforms: `linux/amd64,linux/arm64`. Source of truth: this Gitea repo
(`https://gitea.federated.computer/Federated_Computer/brain.git`) at the
matching tag. The repositories auto-create on first push under the
`federatedcomputer` namespace; keep them **public** so cores can pull
without registry credentials. Never move an existing tag — cut a new
version instead.
### Option A — CI (preferred): push a tag
`.github/workflows/release.yml` runs on Gitea Actions for tags matching
`[0-9]+.[0-9]+.[0-9]+`. A smoke job first builds the migrate image and
bootstraps a throwaway PostgreSQL with it (fresh schema, complete ledger,
idempotent re-run) and runs Go build/vet/unit tests; only then does the
publish job build and push all three images. Prerequisites (one-time,
instance admin):
1. An **act_runner** registered against `https://gitea.federated.computer`
with access to a docker socket.
2. Repo/org **Actions secrets** `DOCKERHUB_USERNAME` and `DOCKERHUB_TOKEN`
(an access token with write permission on the `federatedcomputer`
namespace).
Then releasing is:
```bash
git checkout main && git pull
git tag -a 1.2.3 -m "release 1.2.3"
git push origin 1.2.3
```
Watch the run under the repo's Actions tab; verify with
`docker manifest inspect federatedcomputer/superbrain-app:1.2.3`.
### Option B — manual build & push (no runner required)
From any Linux machine with Docker, buildx and login rights:
```bash
git clone https://gitea.federated.computer/Federated_Computer/brain.git
cd brain && git checkout 1.2.3 # always build from the tag
# One-time per machine: buildx builder + cross-arch emulation
docker buildx create --use --name multiarch
docker run --privileged --rm tonistiigi/binfmt --install arm64
docker login -u <dockerhub-user> # token prompt
# Smoke the migrate image BEFORE publishing (mirrors the CI gate):
docker build -t sb-migrate:smoke db/
docker run -d --name sb-smoke-pg -e POSTGRES_USER=superbrain \
-e POSTGRES_PASSWORD=x -e POSTGRES_DB=superbrain postgres:16.15-alpine
docker run --rm --link sb-smoke-pg -e DB_HOST=sb-smoke-pg -e PGPASSWORD=x sb-migrate:smoke
docker run --rm --link sb-smoke-pg -e DB_HOST=sb-smoke-pg -e PGPASSWORD=x sb-migrate:smoke # re-run: "up to date"
docker rm -f sb-smoke-pg
# Build + push all three (each command pushes <version> and latest):
V=1.2.3
docker buildx build --platform linux/amd64,linux/arm64 --push \
-t federatedcomputer/superbrain-app:$V -t federatedcomputer/superbrain-app:latest .
docker buildx build --platform linux/amd64,linux/arm64 --push \
-t federatedcomputer/superbrain-web:$V -t federatedcomputer/superbrain-web:latest web
docker buildx build --platform linux/amd64,linux/arm64 --push \
-t federatedcomputer/superbrain-migrate:$V -t federatedcomputer/superbrain-migrate:latest db
```
Notes: the arm64 web build runs under qemu and is the slow step (tens of
minutes on modest hardware); the app image is a static Go binary and the
migrate image is `postgres:16.15-alpine` + `db/`, both quick. Go builds
must stay legacy-builder compatible (no `$BUILDPLATFORM` tricks) so local
`docker compose build` keeps working on hosts without BuildKit defaults.
### After publishing
Bump `VERSION=` in `deploy/federated/service` to the new tag (commit it —
hosts sync the service file via `deploy/federated/update.sh`), then on each
core: `/federated/bin/upgrade superbrain` (or update.sh, which syncs the
service file first). The pre-upgrade hook takes a pg_dump and pulls all
three images; `upgrade_app` snapshots, redeploys and rewrites
`IMAGE_VERSION` in the app `.env`.
## Environment variable reference
Everything the stack reads, so a generated `.env` (or hosting environment)