Skip to content

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_deployment recognizes 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_deployment fails with INSECURE_CONFIGURATION (file, line and kind of every finding, never the value) and nothing is built. Values belong in secrets: set them with set_secrets, name them in the contract under secrets and 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 comment helfinity:allow-secret on the same line; node_modules, vendor and 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_deployment shows that under build_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 time estimated_wait_s) and with a hint in notes; phase_progress.phase is then build_queued. The build starts automatically, nothing has to be triggered again.

Flow ​

  1. Request an upload: create_upload with project. The answer contains an upload_url (valid 1 hour, exactly one PUT), the artifact_id and a ready curl command.

  2. Upload: the agent packs the project and uploads it:

    sh
    tar --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 201 with artifact_id, sha256 and size_bytes. 413 means too large, 400 an invalid archive.

  3. 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_dir is relative to the archive's root, dockerfile relative to context_dir. If the Dockerfile is missing, the plan already blocks with BUILD_DOCKERFILE_MISSING, lists what is in the archive and suggests a Dockerfile for recognized stacks. So no build VM is started for nothing.

  4. Roll out with apply_deployment. During the build the deployment is in building. 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.

  5. Read the build output: get_logs with source: "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 byStackSuggestion
package.json with nextNext.jsnpm ci (or pnpm/Yarn depending on the lockfile), npm run build, npm start; 512 MB recommended
package.jsonNode.jsas above, npm run build only when the script exists
go.modGoGo version from go.mod, static binary in distroless/static:nonroot
requirements.txt or pyproject.tomlPythonFastAPI with uvicorn, Flask with gunicorn, otherwise python main.py
index.html without package.jsonstatic siteCaddy 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.

ClassMeaningWhat to do
BUILD_DOCKERFILE_MISSINGNo Dockerfile at the given placeCorrect dockerfile or context_dir, or take the suggested Dockerfile
BUILD_DEPENDENCY_INSTALL_FAILEDnpm install, pip install or similar failedCheck the lockfile, pin versions
BUILD_FAILEDAnother step in the Dockerfile failedRead the build log
BUILD_TIMEOUTLonger than 15 minutesSlim the build down, multi-stage, fewer dependencies
BUILD_OUT_OF_MEMORYThe build needs more than 4 GB of memory plus 4 GB of swapSet 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_LARGEImage above 2 GBSmaller base image, multi-stage build
BUILD_INFRA_FAILEDError of the platform, not of your codeTry 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: large the 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.