Appearance
Build variables
Frameworks such as Vite, Next.js, Nuxt and Astro inline some environment variables into the browser bundle at build time: VITE_*, NEXT_PUBLIC_*, NUXT_PUBLIC_*, PUBLIC_* and similar. Fjordrun passes the service's variables to the build so this works.
How it works
- Generated builds (Node.js frameworks and static sites): every service variable is available to the install and build commands. Set
VITE_API_URLin the service's Variables andimport.meta.env.VITE_API_URLis inlined byvite build. - Repository Dockerfiles: variables are passed as
--build-args. Declare them withARGin your build stage. - Nixpacks (Python, Go and other languages): service variables are not passed into the Nixpacks build; they are only set when the app runs. If a build step needs a variable, add a Dockerfile and declare it with
ARG.
References such as ${{api.FJORDRUN_PUBLIC_DOMAIN}} are resolved before the build, so a frontend can bake in its API's URL:
bash
VITE_API_URL=https://${{api.FJORDRUN_PUBLIC_DOMAIN}}Changing a build variable
Build-time values are part of the built files. After changing one, the service needs a new build: saving the variable redeploys a running service, which rebuilds it from its branch. A rollback reuses an old image and does not pick up new build values.
Secrets and the final image
In generated builds, variables are declared only in the build stage, not in the final image. They are still given to the running container as normal environment variables. Anything your build step writes into its output (such as a VITE_* value in a JavaScript bundle) is public, so never put secrets in browser-exposed variables.
Reserved names
These names are not passed to the build because they would break the build environment: PATH, HOME, HOSTNAME, PWD, SHELL, USER, TERM, PORT, NODE_VERSION, YARN_VERSION, BUN_INSTALL, NODE_ENV, NODE_OPTIONS, COREPACK_HOME, PNPM_HOME, LD_PRELOAD, LD_LIBRARY_PATH. They are still set at runtime.
Variable names must start with a letter or underscore and contain only letters, digits and underscores.