---
url: https://docs.zenavo.app/deploy/build-plan
---

# Build Plan (Dockerfile & zbpack)

Git services are built on Zenavo's build machines with BuildKit. How a service is built is its **build plan**, which you can preview before deploying.

## Dockerfile

If the service's root directory contains a `Dockerfile`, it is used as is. Set a different path under **Advanced Settings** → **Dockerfile path** when adding the service, or later on the service's **Settings** tab → **Dockerfile** (for example `deploy/api.Dockerfile`, relative to the root directory).

## zbpack

Without a Dockerfile, [zbpack](https://github.com/zeabur/zbpack) detects the language and framework and generates one. It supports Node.js, Bun, Deno, Python, Go, PHP, Ruby, Java, Rust, .NET, static sites and more. zbpack is also used when the repository has a `zbpack.json` file, or the service has `ZBPACK_*` environment variables, which configure zbpack (for example its build and start commands).

zbpack-built images listen on port **8080**, so that is the service's HTTP port unless you set another.

### zbpack options

On the service's **Settings** tab → **Build** → **zbpack options**, enter one `KEY=value` per line:

- Keys starting with `ZBPACK_`, such as `ZBPACK_BUILD_COMMAND=npm run build` or `ZBPACK_START_COMMAND=node dist/server.js`, are passed to zbpack as variables. They take precedence over `ZBPACK_*` variables on the **Variables** tab.
- Other keys are written to `zbpack.<service>.json` in the root directory, the same as a `zbpack.json` file in the repository. A value written as JSON (`{…}`, `[…]`, `true` or `false`) keeps its type.

Setting any zbpack option builds the service with zbpack, even when the root directory has a Dockerfile.

## Layer reuse

Builds keep a cache, so a step whose inputs did not change is not run again and keeps its image layer. Servers, and the copy in mainland China, then download only the layers that changed.

- The source is built without its `.git` directory. It differs on every clone, so with it every step after `COPY . .` would run again. A build that runs `git` (for example `git describe` for a version number) fails without it; pass the value as a [build argument](#build-arguments) instead.
- In a Dockerfile zbpack generates for Node.js, the dependencies are installed before the source is copied: first `package.json`, the lockfile and the package manager's configuration (`.npmrc`, `.yarnrc.yml` and the like), then the install, then the rest. A change that leaves the dependencies alone reuses their layer, usually the largest. Projects whose install needs more of the source keep zbpack's order: workspaces, install scripts (`preinstall`, `postinstall`, `prepare` and the like), and patched or local (`file:`, `link:`) dependencies. The build log says when the order was changed.
- In your own Dockerfile, do the same to get the same reuse: copy the dependency files and install before `COPY . .`.

## Build arguments

On the **Settings** tab → **Build** → **Build arguments**, enter one `KEY=value` per line. Each is passed to the build: your own Dockerfile reads it with an `ARG` line of the same name, and in a Dockerfile zbpack generates, Zenavo adds that `ARG` line to every stage that runs a command. Variables on the **Variables** tab with the names front-end frameworks use for public values, `NEXT_PUBLIC_*`, `VITE_*`, `REACT_APP_*`, `VUE_APP_*`, `NUXT_PUBLIC_*`, `PUBLIC_*`, `EXPO_PUBLIC_*` and `GATSBY_*`, are passed to the build by themselves, as on Zeabur; the field's description lists the ones it passes, and a build argument of the same name takes precedence. Changing one takes a redeploy, not a restart. Other variables are not passed, so secrets stay out of the image; to use one, reference it with `${KEY}`, for example `NODE_OPTIONS=${NODE_OPTIONS}`.

Values are hidden in build logs, but a value can be read from the built image's history when the stage that declares it is in the final image, and from the output if the build writes it there. Pass a secret as a build argument only when the build needs it, and never give one a public front-end name: those values end up in the code sent to browsers.

## Root directory

For monorepos, set **Root Directory** to the service's folder, such as `/apps/api`, when adding the service or later on the **Settings** tab. The build uses that folder as its context, for Dockerfiles and zbpack alike. It must be inside the repository.

To redeploy only when that folder changes, set the service's [watch paths](./github.md#watch-paths).

## In the manifest

The **Settings** tab saves these fields of the service's `source` in the project manifest; you can also set them in an exported or imported manifest:

```json
"source": {
  "git": "https://github.com/acme/mono",
  "ref": "main",
  "context": "apps/api",
  "dockerfile": "Dockerfile",
  "build_args": { "NODE_ENV": "production" },
  "zbpack": { "ZBPACK_BUILD_COMMAND": "npm run build" },
  "auto_deploy": true,
  "watch_paths": ["apps/api/", "packages/shared/"]
}
```

## Build Plan Preview

The preview clones the branch and reports what the build will use, without building or running anything:

| Row | Example |
|---|---|
| Provider | `Dockerfile`, `go`, `nodejs`, `python`… |
| Versions | Go Version `1.26.1`, Node.js Version `22` |
| Port | From the Dockerfile's `EXPOSE`, or 8080 for zbpack |

## Limits

Builds share Zenavo's build machines and are queued when they are busy. A build, cloning included, may take as long as the plan's longest build: 15 minutes on Free, 30 on Dev, and 60 on Pro, Team and Enterprise; cloning alone is limited to 10 minutes. A build that reaches the limit stops, the deploy fails, and its minutes still count. See [Usage & Billing](https://docs.zenavo.app/account/billing) for build minutes per plan.
