Home

Awesome

Heroku's .deb Packages Buildpack

CI Registry

heroku/deb-packages is a Heroku Cloud Native Buildpack that adds support for installing Debian packages required by an application that are not available in the build or run image used.

System dependencies on Debian distributions like Ubuntu are described by <package-name>.deb files. These are typically installed using CLI tools such as apt or dpkg. This buildpack implements logic to install packages from .deb files in a CNB-friendly manner that does not require root permissions or modifications to system files that could invalidate how CNB rebasing functionality works.

[!IMPORTANT] This is a Cloud Native Buildpack, and is a component of the Heroku Cloud Native Buildpacks project, which is in preview. If you are instead looking for the Heroku Apt Buildpack (for use on the Heroku platform), you may find it here.

This buildpack is compatible with the following environments:

OSArchDistro NameDistro Version
linuxamd64Ubuntu24.04
linuxarm64Ubuntu24.04
linuxamd64Ubuntu22.04

Usage

[!NOTE] Before getting started, ensure you have the pack CLI installed. Installation instructions are available here.

To include this buildpack in your application:

pack build my-app --builder heroku/builder:24 --buildpack heroku/deb-packages

And then run the image:

docker run --rm -it my-app

Configuration

project.toml

The configuration for this buildpack must be added to the project descriptor file (project.toml) at the root of your project using the com.heroku.buildpacks.deb-packages table. The list of packages to install must be specified there. See below for the configuration schema and an example.

Example

# _.schema-version is required for the project descriptor
[_]
schema-version = "0.2"

# buildpack configuration goes here
[com.heroku.buildpacks.deb-packages]
install = [
    # string version of a dependency to install
    "package-name",
    # inline-table version of a dependency to install
    { name = "package-name", skip_dependencies = true, force = true }
]

Schema

[!TIP] Users of the heroku-community/apt can migrate their Aptfile to the above configuration by adding a project.toml file with:

[_]
schema-version = "0.2"

[com.heroku.buildpacks.deb-packages]
install = [
  # copy the contents of your Aptfile here, e.g.;
  # "package-a",
  # "package-b",
  # "package-c"
]

If your Aptfile contains a package name that uses wildcards (e.g.; mysql-*) this must be replaced with the full list of matching package names.

Environment Variables

The following environment variables can be passed to the buildpack:

NameValueDefaultDescription
BP_LOG_LEVELINFO,<br> DEBUGINFOConfigures the verbosity of buildpack output. The DEBUG level is a superset of the INFO level.

How it works

Detection

This buildpack will pass detection if:

Build

Step 1: Build the package index

Each supported distro is configured to download from the following Ubuntu repositories:

These repositories comply with the Debian Repository Format so building the list of packages involves:

Step 2: Determine the packages to install

For each package requested for install declared in the buildpack configuration:

[!NOTE] This buildpack is not meant to be a replacement for a fully-featured dependency manager like Apt. The simplistic dependency resolution strategy described above is for convenience, not accuracy. Any extra dependencies added are reported to the user during the build process so, if they aren't correct, you should disable the dependency resolution on a per-package basis with configuration and explicitly list out each package you need installed.

Step 3: Install packages

For each package added after determining the packages to install:

Environment VariableAppended ValuesContents
PATH/<layer_dir>/bin <br> /<layer_dir>/usr/bin <br> /<layer_dir>/usr/sbinbinaries
LD_LIBRARY_PATH/<layer_dir>/usr/lib/<arch> <br> /<layer_dir>/usr/lib <br> /<layer_dir>/lib/<arch> <br> /<layer_dir>/libshared libraries
LIBRARY_PATHSame as LD_LIBRARY_PATHstatic libraries
INCLUDE_PATH/<layer_dir>/usr/include/<arch> <br> /<layer_dir>/usr/includeheader files
CPATHSame as INCLUDE_PATHheader files
CPPPATHSame as INCLUDE_PATHheader files
PKG_CONFIG_PATH/<layer_dir>/usr/lib/<arch>/pkgconfig <br> /<layer_dir>/usr/lib/pkgconfigpc files

Contributing

Issues and pull requests are welcome. See our contributing guidelines if you would like to help.