Quick Start
Build and push an image using buildpacks:pack build under the hood. All buildpack-related flags are passed directly to pack.
Build Options
| Flag | Description |
|---|---|
--builder, -B | CNB-compatible builder image (default: heroku/builder:24) |
--buildpack, -b | Additional buildpack to use (can be specified multiple times) |
--dir | Build context directory (default: current directory) |
--push | Push the image to your org’s private registry after building |
--no-cache | Build without using cache |
--env, -e | Environment variable for the build (can be specified multiple times) |
--env-file | File containing environment variables (can be specified multiple times) |
--trust-builder | Trust the builder image (skip security prompts) |
--trust-extra-buildpacks | Trust additional buildpacks |
--platform, -p | Target platform (default: linux/amd64) |
Common Builders
| Builder | Description |
|---|---|
heroku/builder:24 | Default. Supports Node.js, Python, Go, Java, Ruby, PHP, and more |
gcr.io/buildpacks/builder:google-22 | Google Cloud buildpacks |
paketobuildpacks/builder-jammy-base | Paketo community buildpacks (includes .NET, Rust support) |
Language Conventions
The following conventions apply to the defaultheroku/builder:24 unless otherwise noted. Other builders may have different requirements.
Node.js
Node.js
Required files:Example package.json (with start script):Example package.json (with index.js or server.js in root):
package.jsonin the project rootpackage-lock.jsonin the project root
- If
index.jsorserver.jsexists in the root, it will be used automatically - Otherwise, add a
scripts.startcommand inpackage.json - Alternatively, create a
Procfilein the project root
Python
Python
Detection (required - one of):Runtime requirements:
requirements.txt(pip)uv.lock(uv)poetry.lock(Poetry)
- Using uv requires a
.python-versionfile - Using Poetry for a non-packaged app requires
package-mode = falseinpyproject.toml
- Create a
Procfilein the project root - Python buildpacks do not auto-detect an entry file
- Without a
Procfile, the app may build but will not start
- Server must bind to
0.0.0.0 - Server must listen on
$PORT
Go
Go
Required files:
go.modin the project root
- The
mainpackage must be in the project root
- Compiles the
mainpackage - Binary is automatically set as the start command
Java (Maven)
Java (Maven)
Required files:
pom.xmlin the project root
- Runs
mvn package
- Spring Boot JARs: start command is auto-detected
- Non-Spring executable JARs: add a
Procfile(recommended)
- Server must bind to
0.0.0.0 - Server must listen on
$PORT
Java (Gradle)
Java (Gradle)
Required files:
build.gradleorbuild.gradle.ktsin the project rootgradlew(Gradle Wrapper) in the project root
- Runs
./gradlew build
- Spring Boot JARs: start command is auto-detected
- Non-Spring executable JARs: add a
Procfile(recommended)
- Server must bind to
0.0.0.0 - Server must listen on
$PORT
Ruby
Ruby
Required files:Example Procfile (Rails with Puma):
GemfileandGemfile.lockin the project root
- Rails apps: default start command exists, but a
Procfileis recommended - Non-Rails apps: create a
Procfilewithweb: <command>
- Server must listen on
$PORT
PHP
PHP
Required files:
composer.jsonandcomposer.lockin the project root
- Create a
Procfilewithweb: <command>
Rust
Rust
Rust is not supported by the default Build behavior:Process configuration (optional):
heroku/builder:24. Use the Paketo Community Rust buildpack.Required files:Cargo.tomlin the project rootCargo.lockin the project root- A binary target (e.g.
src/main.rsorsrc/bin/*.rs)
- Builds the project using
cargo build --release - The resulting binary is used as the default launch command (or can be overridden via a Procfile)
Note: The binary name is derived from [package].name and must match the Procfile entry exactly.
Runtime requirements:- Server must listen on
$PORT(read from environment variable)
C# / .NET
C# / .NET
C# / .NET is not supported by the default Build behavior:Example Procfile (optional):Runtime requirements:
heroku/builder:24. Use the Paketo .NET buildpacks via a Paketo builder.Required files:- A
.csprojor.fsprojfile in the project root, or - A
.slnfile with referenced projects
- Runs
dotnet publish(Release) - Automatically detects the entry point DLL for single-project apps
- Auto-detected for single-project solutions
- Optional: add a
Procfileto explicitly set or override the start command (recommended for multi-project solutions)
- Server must bind to
0.0.0.0(not127.0.0.1) - Server must listen on
$PORT(recommended: setASPNETCORE_URLStohttp://0.0.0.0:$PORT)
The Procfile
AProcfile defines how your application is started by the platform. Place it in the project root.
- Some languages auto-detect a start command (e.g., Go binaries, Spring Boot JARs)
- Other languages require a
Procfileto start a web server
Build Examples
Troubleshooting
Container starts but crashes immediately
Container starts but crashes immediately
The buildpack built your image but doesn’t know how to start it. Common causes:
-
Missing Procfile: Create a
Procfilein your project root: -
Missing start script (Node.js): Add a
startscript topackage.json: -
Wrong port: Your app must listen on the
$PORTenvironment variable, not a hardcoded port.
Language not detected
Language not detected
Buildpacks detect languages based on specific files. Ensure you have the required files for your language:
| Language | Required File(s) |
|---|---|
| Node.js | package.json + package-lock.json |
| Python | requirements.txt, uv.lock, or poetry.lock |
| Go | go.mod |
| Java | pom.xml or build.gradle |
| Ruby | Gemfile + Gemfile.lock |
| PHP | composer.json + composer.lock |
| Rust | Cargo.toml + Cargo.lock (requires -b docker.io/paketocommunity/rust) |
| C# / .NET | .csproj, .fsproj, or .sln (requires -B paketobuildpacks/builder-jammy-base) |
Rust and C# / .NET are not supported by the default
heroku/builder:24. You must specify an additional buildpack or use a different builder as shown above.Build fails with 'untrusted builder'
Build fails with 'untrusted builder'
In CI/CD environments, add the trust flags:
Rust or .NET not building
Rust or .NET not building
These languages require different builders or buildpacks:Rust:C# / .NET:
Build is slow
Build is slow
Buildpacks cache dependencies between builds. If builds are slow:
- Ensure you’re not using
--no-cacheunless necessary - Check if your dependency files changed (triggers full rebuild)
- Consider using a builder optimized for your language
Learn More
Images Reference
Conceptual overview of images in Control Plane
Push Images Guide
Detailed guide for building and pushing images
CLI Image Commands
Full CLI command reference
Buildpacks.io
Official Cloud Native Buildpacks documentation