Zaroz
Git builds

Languages

Without a Dockerfile, Zaroz builds your code with Railpack. It reads the files in the service's root directory, installs your dependencies, runs your build and sets up a start command. This page says what that means for each language. How Zaroz chooses between a Dockerfile and Railpack is in How builds are detected.

If Zaroz does not recognise your code and there is no Dockerfile, the build stops with detect_failed. Add a Dockerfile, or set the install, build and start commands yourself.

Supported languages

LanguageDetected byVersion setting
Nodepackage.jsonbuild.versions.node
Pythonrequirements.txt, pyproject.toml, Pipfile, setup.pybuild.versions.python
Gogo.modbuild.versions.go
PHPcomposer.jsonbuild.versions.php
Javapom.xml, build.gradle, build.gradle.ktsbuild.versions.java
RubyGemfilebuild.versions.ruby
Static filesindex.htmlnone

When a repository has files for several languages, the first one that applies in this order wins: PHP, Go, Java, Ruby, Python, Node, then static files. A Laravel app has a package.json for its assets, and it is still a PHP app. If Zaroz picks the wrong one, set the root directory to the folder of the app you mean, or use a Dockerfile.

Zaroz also names the framework when it finds one, so the console can tell you what it saw: Next.js, Vite, Astro, Laravel, Rails, Django and Spring. The build itself follows the language.

Versions

You can pin a version in the console (Build settings, {language} version) or in zaroz.toml:

Code
[build] versions = { node = "22", python = "3.12" }

A version you set always wins. When you set none, Railpack picks one from the usual version files of the language, such as .node-version, .nvmrc or engines in package.json for Node, .python-version for Python, go.mod for Go and .ruby-version for Ruby, or its own default when it finds none. Pin the version if you want builds to stay the same when a default moves.

To pin Railpack itself, set build.railpack_version. Only versions Zaroz offers are accepted. Without it the current one is used.

Install, build and start

Railpack works out an install command, a build command and a start command from your files. You can replace any of the three:

SettingReplaces
build.installThe install command
build.commandThe build command
deploy.startThe start command
Code
[build] install = "npm ci" command = "npm run build" [deploy] start = "node dist/server.js"

If your project defines a start script, such as npm start, Railpack uses it. Most frameworks have a production start command that Railpack knows. When nothing tells it how to start your app, set deploy.start.

Node

  • Zaroz detects the package manager from the lockfile: package-lock.json, yarn.lock, pnpm-lock.yaml or a Bun lockfile. Commit your lockfile. Without one, installs are not repeatable, and Zaroz warns you.
  • A private registry needs a build secret, for example NPM_TOKEN read from an .npmrc that uses ${NPM_TOKEN}.
  • A frontend framework that bakes values at build time needs them as build variables.
  • A static frontend, such as Vite or Astro, is better served as a static site than as a Node process.

Python

  • Dependencies come from requirements.txt, pyproject.toml or a Pipfile.
  • A private package index needs a build secret. The page has recipes for pip, poetry and others.
  • Set deploy.start for a web app, for example gunicorn app:app --bind 0.0.0.0:$PORT, if your project has no command Railpack recognises.

Go

  • Zaroz builds the module from go.mod into one binary. Keep the main package where Go expects it, or set build.command and deploy.start.
  • With a monorepo, set the root directory to the folder that holds go.mod.

PHP

  • Dependencies come from composer.json. A private Composer repository needs a build secret.
  • Laravel is recognised. Set APP_KEY and the rest of your configuration as environment variables of the service, and run migrations as a pre-deploy command.

Java

  • Maven (pom.xml) and Gradle (build.gradle, build.gradle.kts) projects are built. A private repository needs a build secret.
  • Spring is recognised. Its usual port is 8080, which is also Zaroz's default.
  • Java builds use more memory. If a build stops with out_of_memory, rebuild on a larger builder. See Build minutes.

Ruby

The port: your app must listen on $PORT

Zaroz sends traffic to one port of your container and never guesses it from your code. The port is in the PORT environment variable, and the default is 8080. Your app must listen on it, on all addresses (0.0.0.0), not only on localhost.

JavascriptCode
app.listen(process.env.PORT || 8080, "0.0.0.0");

To use another port, set Port in the build settings, or deploy.port. When you connect a repository, the console suggests a port: from an EXPOSE line in your Dockerfile, or the usual one of a framework it recognises (3000 for Next.js and Rails, 8000 for Django, 8080 for Spring). It is only a suggestion until you save it.

An app that listens on another port never becomes healthy, and the deploy stops with health_check_failed.

Build cache

The build keeps a cache of your dependencies and layers for this service, so later builds are faster. Turn it off with build.cache = false, or choose Rebuild without cache for one build. See Limits for how much is kept.

Last modified on