Build from source
As of: November 13, 2026
If you have no finished image, your agent uploads the source code as an archive, and the platform builds an image from it. The build runs with BuildKit in a throwaway VM (Hetzner CX23, alternatively CPX22) in its own Hetzner project, separate from the platform. Within its paid hour the VM serves only further builds of your account and is deleted afterwards. There are no platform credentials on the VM. A small build is finished and rolled out after a little more than a minute.
Prerequisites
- A Dockerfile in the archive. If it is missing,
plan_deploymentrecognizes common stacks and suggests a fitting Dockerfile (see No Dockerfile?); the platform cannot build without a Dockerfile yet. - A gzip-compressed tar archive with relative paths: at most 200 MB packed, 1 GB unpacked, 100,000 entries.
- No credentials in the code. The platform checks every source archive before the build for keys and tokens of known services and private keys; if it finds any,
plan_deploymentfails withINSECURE_CONFIGURATION(file, line and kind of every finding, never the value) and nothing is built. Values belong in secrets: set them withset_secrets, name them in the contract undersecretsand read them from the environment in the app. A found value was in the archive, so revoke it at the provider. You mark intentional test values with the commenthelfinity:allow-secreton the same line;node_modules,vendorand Python virtual environments are not checked. - The finished image may be at most 2 GB.
- A build may run at most 15 minutes.
- The platform currently runs at most two builds at a time, at most two of them per account; more wait in order (oldest first) until a VM is free. If an account already has two builds running, builds of other accounts start before its further ones, so nobody occupies the queue alone. While a build waits,
get_deploymentshows that underbuild_queue(code: "BUILD_QUEUED",reason:capacity= all build VMs busy,org_limit= two own builds are running;position,running,max_parallel,org_running,org_max_parallel, roughly estimated waiting timeestimated_wait_s) and with a hint innotes;phase_progress.phaseis thenbuild_queued. The build starts automatically, nothing has to be triggered again.
Flow
Request an upload:
create_uploadwithproject. The answer contains anupload_url(valid 1 hour, exactly one PUT), theartifact_idand a readycurlcommand.Upload: the agent packs the project and uploads it:
shtar --exclude=node_modules --exclude=.git -czf app.tar.gz . curl -sS -X PUT --data-binary @app.tar.gz -H 'Content-Type: application/gzip' '<upload_url>'Answer
201withartifact_id,sha256andsize_bytes.413means too large,400an invalid archive.Plan with
source.type: "upload":json{ "api_version": "v1alpha1", "services": [{ "name": "api", "source": { "type": "upload", "artifact_id": "art_…", "context_dir": "backend", "dockerfile": "Dockerfile" }, "port": 8080, "resources": { "memory_mb": 512 } }] }context_diris relative to the archive's root,dockerfilerelative tocontext_dir. If the Dockerfile is missing, the plan already blocks withBUILD_DOCKERFILE_MISSING, lists what is in the archive and suggests a Dockerfile for recognized stacks. So no build VM is started for nothing.Roll out with
apply_deployment. During the build the deployment is inbuilding. If the platform builds the same archive with the same Dockerfile a second time in the same project, it uses the finished image and does not build again.Read the build output:
get_logswithsource: "build".
An archive stays stored until 24 hours after the first successful build, without a build at most 7 days. For a later build you upload again; the built image stays as long as a revision uses it. At most 60 uploads per hour and organization.
No Dockerfile?
If the Dockerfile is missing, plan_deployment looks into context_dir and recognizes these stacks:
| Recognized by | Stack | Suggestion |
|---|---|---|
package.json with next | Next.js | npm ci (or pnpm/Yarn depending on the lockfile), npm run build, npm start; 512 MB recommended |
package.json | Node.js | as above, npm run build only when the script exists |
go.mod | Go | Go version from go.mod, static binary in distroless/static:nonroot |
requirements.txt or pyproject.toml | Python | FastAPI with uvicorn, Flask with gunicorn, otherwise python main.py |
index.html without package.json | static site | Caddy as file server |
The suggestion is in checks[].suggestion of the check BUILD_DOCKERFILE_MISSING, together with what the agent should check before using it (missing start script, module name, lockfile). The platform never creates the file itself: the agent puts it into its project, uploads again and plans again. All templates at once: get_platform_info(topic='dockerfile_templates'). All templates listen on $PORT (default 8080); except the static one they run without root.
When the build fails
The deployment ends with failed and a diagnosis. The previous version keeps running.
| Class | Meaning | What to do |
|---|---|---|
BUILD_DOCKERFILE_MISSING | No Dockerfile at the given place | Correct dockerfile or context_dir, or take the suggested Dockerfile |
BUILD_DEPENDENCY_INSTALL_FAILED | npm install, pip install or similar failed | Check the lockfile, pin versions |
BUILD_FAILED | Another step in the Dockerfile failed | Read the build log |
BUILD_TIMEOUT | Longer than 15 minutes | Slim the build down, multi-stage, fewer dependencies |
BUILD_OUT_OF_MEMORY | The build needs more than 4 GB of memory plus 4 GB of swap | Set a heap limit (e.g. ENV NODE_OPTIONS=--max-old-space-size=3072), fewer parallel jobs (make -j2, cargo build -j 2), or source.build_size: large (8 GB, counts double) |
IMAGE_TOO_LARGE | Image above 2 GB | Smaller base image, multi-stage build |
BUILD_INFRA_FAILED | Error of the platform, not of your code | Try again later; does not count as a build |
If the cloud provider lacks capacity for a build VM right now, the build waits in the queue (event build_waiting, at most 1 hour) instead of failing at once.
Limits and costs
- Builds per day by trust level: level 1: 30, level 2: 100, level 3: 300.
- 100 builds per month are included, after that a build costs 0.05 € (Prices). Builds that fail because of the platform do not count.
- The build VM has 4 GB of RAM. With
source.build_size: largethe build runs on a VM with 8 GB; it counts as two builds. - During the build the VM has internet access (to load packages), but no access to your other services or the platform.