Builds
Each deploy from GitHub clones your branch and builds an image from it. CTRL picks how to build in this order:
- Your repo's own
Dockerfile. - CTRL's stack detector, which writes a Dockerfile for you.
- Nixpacks, when the detector finds nothing it knows.
All the checks look at the repo root only.
Your own Dockerfile#
If there is a file named Dockerfile at the repo root, CTRL builds it as it is, with buildah. Nothing else is detected. When you pick a branch, the dashboard shows Dockerfile found.
A few things to know about how the image runs:
- Your app's env vars are set when the app runs. They aren't passed to the build.
- CTRL doesn't set
PORTfor you. Listen on the exposed port you chose, or add aPORTenv var yourself. - Listen on
0.0.0.0, not127.0.0.1. ENTRYPOINTandCMDrun without a shell. If your command needs$VARIABLES, use the shell form orsh -c.- A
USERline is ignored. Your app runs as root inside its own VM. /runand/tmpare empty at every boot, so don't put files there at build time.
A Dockerfile that is a symlink to a file outside the repo is refused. Commit the Dockerfile itself.
The stack detector#
With no Dockerfile, the dashboard says: "No Dockerfile at root. CTRL will detect your stack (Node, Python, Go, Rust, Ruby, PHP or a static site) and build it. Your app must listen on the port in $PORT."
CTRL tries each stack in this order and uses the first that fits. Server stacks come before Node, so a backend with a frontend package.json builds as the backend.
| Order | Stack | Found by | Base image |
|---|---|---|---|
| 1 | Go | go.mod |
golang:1-bookworm, run on debian:bookworm-slim |
| 2 | Rust | Cargo.toml |
rust:1-bookworm, run on debian:bookworm-slim |
| 3 | Ruby | Gemfile |
ruby:3.3-bookworm |
| 4 | PHP | composer.json |
composer:2, run on php:8.3-cli-bookworm |
| 5 | Python | requirements.txt or pyproject.toml |
python:3.12-slim-bookworm |
| 6 | Node | package.json |
node:22-bookworm-slim |
| 7 | PHP | index.php |
php:8.3-cli-bookworm |
| 8 | Static site | index.html |
nginx:1-bookworm |
Every generated image sets PORT to your app's exposed port. Your app must listen on it.
The build log prints the stack it found and the whole Dockerfile it wrote, so you can see exactly what ran.
Procfile#
For Ruby, PHP, Python and Node, a web: line in a Procfile at the root wins over the default start command. It runs through sh -c, so $PORT works:
web: gunicorn app:app --bind 0.0.0.0:$PORT
A Procfile alone is not a stack. It needs one of the files in the table.
Go#
CTRL builds with CGO_ENABLED=0 go build. It builds the root package when there is a main.go at the root. Without one, it builds the only directory under cmd/. With more than one directory under cmd/ and no root main.go, it won't guess.
Rust#
CTRL runs cargo build --release and needs exactly one binary in target/release. The runtime image has ca-certificates and libssl3.
Ruby#
CTRL runs bundle install without the development and test groups, and sets RACK_ENV and RAILS_ENV to production. It starts the app with, in order:
- the
Procfileweb:line bundle exec rails server -b 0.0.0.0 -p ${PORT}, if there isbin/railsbundle exec rackup -o 0.0.0.0 -p ${PORT}, if there isconfig.ru
PHP#
With composer.json, CTRL runs composer install --no-dev. It serves the app with PHP's built-in server: from public/ if there is public/index.php, else from the repo root. A Procfile web: line wins over both.
When the root is served, every file in the repo can be fetched. Don't commit secrets, such as a .env file.
Python#
CTRL installs with pip install -r requirements.txt, or pip install . when there is only pyproject.toml. It starts the app with, in order:
- the
Procfileweb:line python manage.py runserver 0.0.0.0:${PORT} --noreload, if there ismanage.pypython main.py,python app.pyorpython server.py, the first one found
With option 3, your code must read PORT itself.
Node#
CTRL installs with the lockfile it finds:
| Lockfile | Install command |
|---|---|
pnpm-lock.yaml |
pnpm install --frozen-lockfile |
yarn.lock |
yarn install --frozen-lockfile |
package-lock.json |
npm ci |
| none | npm install |
Then it runs npm run build --if-present and sets NODE_ENV=production. It starts the app with, in order:
- the
Procfileweb:line npm start, if there is astartscript or aserver.jsnode index.jsnode app.js
Static site#
With an index.html at the root, CTRL serves the repo with nginx on your port. Files starting with a dot aren't served.
If package.json has a build script, the index.html is taken to be source, not a finished site, and isn't served as it is. Add a start script that serves your build output, or add a Dockerfile.
Build cache#
Generated builds install your dependencies again on every deploy. Builds from your own Dockerfile reuse cached layers.
Nixpacks fallback#
When the detector finds no stack, CTRL asks Nixpacks to plan the build. The build log says "no Dockerfile and no stack CTRL detects: Nixpacks planned the build:" and prints the Dockerfile Nixpacks wrote. Nixpacks also gets PORT set to your exposed port.
Your repo must not have a .nixpacks file or directory of its own. Nixpacks gets 2 minutes to plan.
If Nixpacks can't build the repo either, the deploy fails with both reasons. See below.
Build errors#
When a build fails, the deploy screen says "deploy failed. Fix the cause and try again." and the error is in the build output above it. Build lines start with [build], [git] or [buildah]. A first deploy that fails is removed, so you can fix the repo and deploy again. You can read the build log later too, see Logs and metrics.
Could not detect how to build this repo#
Could not detect how to build this repo. CTRL looked in the repo root for: Dockerfile; package.json (Node); requirements.txt or pyproject.toml (Python); go.mod (Go); Cargo.toml (Rust); Gemfile (Ruby); composer.json or index.php (PHP); index.html (static site).
Found: <what CTRL found>.
Add a Dockerfile, or one of the files above. Without a Dockerfile, your app must listen on the port in $PORT.
Nixpacks could not build it either: <reason>
The Found: lines tell you what was missing. The common ones:
| Found | Fix |
|---|---|
package.json, but no "start" script, Procfile web: line, server.js, index.js or app.js |
Add a start script to package.json |
package.json, but it is not valid JSON (...) |
Fix the JSON |
a Python project, but no Procfile web: line, manage.py, main.py, app.py or server.py |
Add a Procfile with a web: line, or one of those files |
go.mod, but no main.go at the root and more than one directory under cmd/ |
Add a Dockerfile that builds the command you want |
Gemfile, but no Procfile web: line, bin/rails or config.ru |
Add a Procfile with a web: line |
composer.json, but no Procfile web: line, public/index.php or index.php |
Add public/index.php, or a Procfile |
<file> is larger than 1048576 bytes, so it was ignored |
Keep package.json and Procfile under 1 MB |
<file> is a symlink pointing outside the repo, so it was ignored |
Commit the file itself |
Your code lives in a subdirectory? CTRL only looks at the root. Add a Dockerfile at the root that builds from the subdirectory.
Other build errors#
| Error | What it means |
|---|---|
Dockerfile is a symlink pointing outside the repo. CTRL will not follow it: commit the Dockerfile itself. |
Replace the symlink with the real file |
CTRL needs exactly one binary in target/release, found <n>. Add a Dockerfile to choose. |
Your Rust workspace builds more than one binary. Add a Dockerfile |
the repo has its own .nixpacks; remove it, or add a Dockerfile |
Delete .nixpacks from the repo |
Nixpacks took longer than 2 minutes |
Add a Dockerfile |
git clone failed (exit code ...) |
Check that the branch exists and that your GitHub account can still read the repo |
commit <sha> cannot be fetched from the repository (force-pushed away or deleted?) |
The commit is gone from GitHub, often after a force-push. Deploy a commit that exists |
buildah build failed: |
A step in the Dockerfile failed. The last 50 lines of output follow |
If the log shows [build] WARNING: could not open the build network, downloads in RUN steps may fail, the build may have no network, and steps that download packages can fail.