Container images (CI)¶
.github/workflows/images.yml builds the backend and frontend images and pushes them to GitHub Container Registry (ghcr.io/tomoda-labs/tomoda-{backend,frontend}). It does not deploy. Deployment is Argo CD in the devops repo, covered in Deployment.
Tags¶
| Trigger | Tags | Picked up by |
|---|---|---|
Push to main (only images whose directory changed) |
:dev-<sha>, :dev |
Argo CD Image Updater for tomoda-dev (tracks dev-*) |
| Called by the Release workflow with its tag | :vX.Y.Z |
The Release run's bump-prod job, which opens the devops PR pinning prod; merging it deploys |
Manual dispatch on main, tag blank |
:dev-<sha>, :dev (both images) |
Same as main |
Manual dispatch with tag |
:vX.Y.Z |
Nothing; run Release in repair mode to open the deploy PR |
Manual dispatch on any other branch, tag blank |
nothing | Builds are skipped, so unmerged code never reaches dev |
With a tag, the workflow first checks it is exactly vX.Y.Z and points at a commit on main (verify-tag), builds from that commit, and skips an image whose :vX.Y.Z is already in GHCR, so a re-run rebuilds only what is missing.
Images are linux/amd64 (the cluster is x86 bare metal). Builds run on GitHub-hosted runners with the GitHub Actions layer cache, not the in-cluster tomoda-arc pool: a broken cluster can still build the images it needs to recover, and privileged Docker builds stay off the prod server. They use the plan's included Actions minutes.
What rebuilds on a push to main: an image builds only when a file it is built from changed. Tests (*_test.go, __tests__/, *.test.*), Markdown, backend/tests/ and the native-only frontend files (fastlane/, Gemfile*, native-build.json, fingerprint.config.js, native-fingerprint*.txt) don't trigger a build; editing images.yml rebuilds both. Caching: Go modules and the pinned codegen tools (wire, swag) sit in image layers keyed on go.mod/go.sum, and the Go build cache is carried between runs with actions/cache (buildkit-cache-dance), so a code change recompiles only the packages it touched.
Backend build args¶
| Build arg | Value |
|---|---|
COMMIT_SHA |
github.sha |
VERSION |
vX.Y.Z on release, dev-<sha> otherwise |
These surface in GET /health and version logs.
Frontend build args (load-bearing)¶
The frontend image bakes EXPO_PUBLIC_* values into the JS bundle at build time; changing them needs a rebuild. The workflow sets them per environment:
| Build arg | Dev | Prod |
|---|---|---|
EXPO_PUBLIC_API_URL |
https://api-dev.tomoda.life/api/v1 |
https://api.tomoda.life/api/v1 |
EXPO_PUBLIC_WS_URL |
wss://api-dev.tomoda.life/ws |
wss://api.tomoda.life/ws |
EXPO_PUBLIC_WEB_URL |
https://app-dev.tomoda.life |
https://app.tomoda.life |
EXPO_PUBLIC_GOOGLE_*_CLIENT_ID |
dev OAuth clients | prod web client (iOS/Android shared) |
COMMIT_SHA / VERSION |
surfaced as EXPO_PUBLIC_COMMIT_SHA / EXPO_PUBLIC_APP_VERSION |
same |
Anything prefixed EXPO_PUBLIC_ is shipped to clients; see Secrets.
Retention¶
GHCR keeps every version forever, and the org's private package storage is capped, so .github/workflows/ghcr-cleanup.yml prunes both packages every Monday at 03:17 UTC:
| Version | Kept |
|---|---|
:vX.Y.Z |
Always (rollbacks pin them) |
:dev |
Always |
:dev-<sha> |
The 10 newest, plus any under a day old |
| Untagged | Only if under a day old, or a platform or attestation manifest of a kept tag |
Builds attach a provenance attestation, so each tag points at an image index whose platform and attestation manifests appear as untagged versions in the GitHub UI. The cleanup action resolves those children and deletes them only with their parent, so a kept tag always stays pullable. The job summary lists the tags kept and the versions deleted.
A manual run (Actions → GHCR cleanup → Run workflow) is a dry run by default: it logs what would be deleted and changes nothing. Untick dry_run to delete. Deleting needs the Admin role for this repo under each package's Package settings → Manage Actions access. A deleted version can be restored for 30 days through the GitHub REST API (restore package version); the cleanup log prints each deleted version ID.
Release flow¶
Prod images are built inside a Release run, which then opens the devops deploy PR and, once that PR is merged, publishes the prod OTA bundle. Deployment → Releasing covers the inputs, each job, re-runs and repair, and the one-time setup (release GitHub App, GHCR package access).
The cluster pulls from GHCR with node-level credentials; see DevOps → OVH bare metal.