tb_sys_build_runtime_config
Build runtime config
When to use
Use whenever a resource needs server-side build logic, runtime environment variables, or deployment-time setup. For Go functions, also load tb_sdk_go_*.
How builds are triggered
-
Resource code and config are pushed to GitHub (normal
git pushworkflow for the function, website, or library repo as appropriate). -
Remote cloud
After the push, the cloud is reached from GitHub (webhook). Builds trigger automatically — no extra inject step on your machine. -
Local Dream
GitHub cannot call into your laptop, so webhooks do not drive Dream the same way. After pushing to GitHub you must trigger the build from the local machine using Dream inject:Command Use for dream inject push-allConfig and code for the whole project — run from the project root ( --path= absolute project root).dream inject push-specificIndividual resource repos that need their own inject after a full sync — e.g. libraries and websites (per-resource repo path and identifiers). Always run
push-allsuccessfully beforepush-specificwhen both apply. Universe, Docker, and flag details (e.g.--rid,--fnfor websites) live intb_wf_dream_inject_and_verify.
Targets
- Function:
<project>/code/.../functions/<name>/.taubyte/ - Website repo:
<project>/websites/tb_website_<name>/.taubyte/ - Library repo:
<project>/libraries/tb_library_<name>/.taubyte/
Required checks
.taubyte/config.yamlexists and is valid (image, workflow, etc. — not runtime env var declarations)..taubyte/build.shexists, is non-empty, writes output Taubyte expects (e.g. function wasm + ret-code, website assets under/out).- Runtime env vars (if any) are set in
.taubyte/build.sh(e.g.export …before build steps), not inconfig.yaml.
Function config.yaml pattern
version: 1.00
environment:
image: taubyte/go-wasi:latest
workflow:
- build
Keep config.yaml for image/workflow and similar metadata only.
Function build.sh pattern
#!/bin/bash
. /utils/wasm.sh
# Runtime env for this build (example — use real names/values your code expects):
# export MY_VAR=value
build "${FILENAME}"
ret=$?
echo -n $ret > /out/ret-code
exit $ret
Website build.sh (technology-specific)
Website build.sh is not one generic script — it must match how that repo is built (package manager, package.json scripts, and especially where the bundler writes static files). Treating every Node site like Vite (always dist/) is wrong for Create React App and other stacks that emit build/ or another directory.
Always
- Produce a non-empty
/out(Taubyte’s deploy staging path inside the build environment — not the same as a framework’s ownoutfolder name on disk). - Put build-time env here with
export, not inconfig.yaml.
Pick the pattern from the repo
Read package.json (scripts.build or equivalent) and the framework docs to learn the real output directory, then copy that tree into /out.
Examples (illustrative — adjust to the project)
-
Plain static (no bundler):
#!/bin/bash cp index.html /out/ -
Vite (default output
dist/):#!/bin/bash npm ci npm run build cp -r dist/* /out/ -
Vite + same-origin API (static site and
/api/...handlers on the same configured domain — typical full-stack Taubyte):- In
vite.config.ts, useenvPrefix: ["VITE_", "APP_"]when the client readsAPP_*at build time (e.g. optional API base override). - Prefer
window.location.originas the default API base when unset so the browser hits same-origin HTTP functions after deploy. - Document
APP_API_BASE_URL(or equivalent) in.env.examplefor Dream/local when the API is on another host or port. - In config, attach website and HTTPS functions to the same
domainsentry so relative/api/...calls resolve.
- In
-
Create React App /
react-scripts(outputbuild/, notdist/):#!/bin/bash npm ci npm run build cp -r build/* /out/ -
Other stacks (Next, Nuxt, custom webpack, etc.): run that project’s install + production build commands, then
cp -r <framework-output-dir>/* /out/using the directory that tool actually generates (check docs and a local build once if unsure).
Rules
- Env vars: declare and use them in
.taubyte/build.shonly; do not put runtime env declarations in.taubyte/config.yamlfor this purpose. - Websites: tailor
build.shto the actual framework and build output (e.g. Vite →dist/, CRA →build/); never copy a Vite-only script onto a React-CRA repo without changing paths and commands. - Do not push to GitHub before validating
.taubyte/build.shand.taubyte/config.yaml. - After changing build/config, remote cloud: rely on webhook-driven builds after push; Dream: run
dream inject push-alland, for website/library resource repos,dream inject push-specificas required, then verify logs/build pertb_sys_push_build_verify. - Document notable env or build assumptions in the context log (
tb_sys_context_log). - For Go compile issues, validate handler code against
tb_sdk_go_*.
More from taubyte/skills
verifying-taubyte-functions
Verifies a Taubyte Go function locally via the `taubyte/go-wasi` Docker recipe (preferred over `tau build`, with tmpfs+bind-mount-ro to avoid root-owned artifacts in the source tree), and verifies a function actually serves on Dream by curling the gateway with the right `Host:` header (plus `/etc/hosts` mapping for `*.localtau`). Use when locally compiling a Go function to WASM, when smoke-testing a function before pushing, or when probing a Dream-hosted HTTP function from the laptop.
12creating-taubyte-resources
Creates Taubyte resources non-interactively via `tau new` for domain, website, library, function, application, database, storage, messaging, and service. Encodes the project-vs-application scope rule, the database `min < max` constraint, the website/library `--generate-repository` + import sequence, and the forbidden `--generated-fqdn-prefix` flag. Use when adding any resource to a Taubyte project's config repo.
12taubyte-resource-creation
Scope-aware resource creation workflow. Uses non-interactive mode by default and references the shared flags catalog.
11taubyte-push-build-verify
Pushes config/code and verifies builds/logs. Includes website/library push handling with tau command first, git fallback.
11taubyte-scope-routing
Routes project-level vs application-scoped work; defaults to a website when a browser UI is logically appropriate; avoids unnecessary applications for simple website/function-only tasks unless needed.
11understanding-taubyte-architecture
Explains the Taubyte mental model — `tau` CLI vs `dream` local cloud, remote-vs-local cloud types, GitHub as the single source of truth, and the config/code/website/library repo layout that drives builds. Use when the user asks how Taubyte fits together, why pushes don't show up, what repos are needed, or whether to use Dream or a remote cloud.
11