Heroku-24 Stack
Last updated December 04, 2024
Table of Contents
This article describes the Heroku-24 stack, based on Ubuntu 24.04. What is a stack?
What’s new
This stack is now based on Ubuntu 24.04, compared to Ubuntu 22.04 used in the Heroku-22 stack.
The most important changes compared to Heroku-22 are:
- We adjusted the Ubuntu packages installed on the stack to reduce the
size of the base images:
- We removed some less frequently used packages (such as Bazaar and Mercurial).
- We made some tools that are typically only required during the build (such as GCC, Make, Git and system Python) available only at build time, rather than at app run time too.
- We made several changes to the Heroku-24 Docker images:
- We now publish them as multi-architecture images, that support both the
amd64
andarm64
architectures instead of onlyamd64
. - We now set the default image Linux user to
heroku
instead ofroot
.
- We now publish them as multi-architecture images, that support both the
See the upgrade notes for more detailed change information.
Available software
Every stack on Heroku supports different operating system packages and language runtime versions. This support is typically confined to software that was still actively developed by the respective maintainers at the time the stack was first released.
Language runtimes
For the most accurate information on supported language runtime versions, please check the individual language pages:
Buildpack | Shorthand | Runtime versions |
---|---|---|
Ruby | heroku/ruby |
Runtime versions |
Node.js | heroku/nodejs |
Runtime versions |
Python | heroku/python |
Runtime versions |
Java | heroku/java |
Runtime versions |
PHP | heroku/php |
Runtime versions |
Go | heroku/go |
Runtime versions |
Operating system packages
For a full list of operating system packages available on Heroku-24, please refer to article Ubuntu Packages on Heroku Stacks.
Support period
Heroku-24 is based on Ubuntu 24.04. It will be supported through April 2029. Learn more about Heroku’s stack update policy.
Using Heroku-24
Heroku-24 is currently the default stack for newly created apps.
You can specify a stack when creating an app:
$ heroku create --stack heroku-24
You may change the stack on an existing app; the next build performed will then use the new stack:
$ heroku stack:set heroku-24
If you are using app.json
, you should also specify the stack there to
ensure that your Review Apps and Heroku CI runs use the same stack:
{
"stack": "heroku-24"
}
An existing app’s stack cannot be changed using app.json
. The stack specified is only applied
to newly created apps that are a Review App, a
Heroku CI test run app, or an app created using a Heroku Button.
Upgrading to Heroku-24
Please refer to the stack upgrading guide to understand the procedures to follow when upgrading to a new stack.
We recommend that you monitor your application closely after migrating an app to the new stack to ensure it’s performing correctly.
Upgrade notes
Changes to Git
Git is now only available at build time and not also at app run time.
The .git/
metadata directory for an app’s Git repository has never been available during the
build or at run time, even when using older stacks. As such, if your app invokes Git at run time
to determine the deployed source revision (commit SHA), these calls will have always failed due
to the lack of a valid repository.
If you need to determine the currently deployed revision of your app, either use the env var
SOURCE_COMMIT
during the build, or enable the Dyno Metadata feature and
use the env var HEROKU_BUILD_COMMIT
at run time.
If your app needs Git at run time for other purposes, install it using the APT buildpack:
- Add the buildpack (if you are not already using it), with:
heroku buildpacks:add --index 1 heroku-community/apt
- Create a file named
Aptfile
in the root of your app source code, containing the package namegit
on its own line. - Add
export GIT_EXEC_PATH=/app/.apt/usr/lib/git-core
to any Bash scripts that call Git at run time, so that Git can find the custom installation. (This step is only necessary until heroku/heroku-buildpack-apt#137 is fixed, and prevents agit: 'remote-https' is not a git command
error.)
Changes to system Python
The system Python installation in the base image is now only available at build time, and not
also at app run time. In addition, the system Python installation is now only available via
the python3
command, and not also via the transitionary python
symlink.
These changes will not affect apps using the Python buildpack since the Python installation provided by the buildpack takes precedence over the system Python installation.
If your app needs Python at run time and was not already using the Python buildpack you must add the
Python buildpack to your app. Run heroku buildpacks:add --index 1 heroku/python
, create an empty
requirements.txt
file in the root directory of your app source code, and then deploy the changes.
We recommend that you use the Python buildpack instead of relying on system Python, since the buildpack supports specifying a Python version, installing dependencies, and configures Python/your app for best performance on the platform.
Changes to the Docker images published to Docker Hub
We now publish the Heroku-24 Docker images as multi-architecture
images, that support both the amd64
and arm64
architectures instead of only amd64
. If you
use these images outside of Heroku on a machine with an ARM CPU, Docker will now automatically
use the arm64
architecture instead of amd64
. To switch back to the amd64
architecture pass
--platform linux/amd64
to docker build
or docker run
, or use
FROM --platform=linux/amd64 IMAGE_NAME
in your Dockerfile
.
In addition, we now set the default Linux user for these Docker images to heroku
, which does not
have root permissions. If you need to modify locations outside of /home/heroku
or /tmp
you will
need to switch back to the root
user. To do this add USER root
to your Dockerfile
when
building images, or pass --user root
to any docker run
commands.
OpenJDK default version has changed
The default OpenJDK version used to run Java, Scala and Clojure apps has changed. Instead of defaulting to OpenJDK 8, the most recent long-term support release will be installed. This is currently OpenJDK 21 but will change as soon as OpenJDK 25 is released. Older stacks continue to install OpenJDK 8 by default for now. We recommend that you always explicitly configure the required OpenJDK version as described here.
Additional English locales no longer installed
The stack now only includes the C
, C.utf8
, POSIX
and en_US.utf8
locales, and not the
additional en_*
variants that were previously provided by the language-pack-en
package.
If you require one of the removed locales, install them using
heroku-buildpack-locale.
The default locale, POSIX
, remains unchanged.
The APT sources list location and format has changed
In Ubuntu 24.04, the location of the
APT sources list has
changed from /etc/apt/sources.list
to /etc/apt/sources.list.d/ubuntu.sources
and the file now
uses the new deb822
format.
We have updated the heroku-buildpack-apt buildpack
to be compatible with this change. However, any third party buildpacks that use APT to install
packages and override the default dir::etc::sourceparts
location will need adjusting for this change
(example compatibility fix).
The legacy Google Chrome buildpack is no longer supported
The heroku-buildpack-google-chrome buildpack is not compatible with Heroku-24. We have sunset it in favour of the newer Chrome for Testing buildpack, which addresses several limitations of the old buildpack. Migrate to the new buildpack using these instructions.
The Redis Stunnel buildpack is no longer supported
The heroku-buildpack-redis buildpack is not compatible with Heroku-24. We have sunset it since Redis 6+ supports TLS natively, which makes the buildpack redundant. Remove the buildpack and switch to Redis’ native TLS support instead. For more information, see Securing Heroku Redis.
Heroku-24 Docker images
Heroku-24 is available as two Docker images:
- The run time image (
heroku/heroku:24
), which is recommended over the build image for most workloads. - The build image (
heroku/heroku:24-build
), which is larger as it includes development headers and toolchains. It is only recommended for customers that need to compile source code or dependencies.
Use the following command in your Dockerfile
to use Heroku-24 as your base image:
FROM heroku/heroku:24
We publish these images as multi-architecture images, supporting both the amd64
and arm64
CPU architectures. By default Docker will use the image architecture that matches the machine on
which it is being run. To force the use of a different architecture, pass
--platform linux/<architecture>
to docker build
or docker run
commands, or use
FROM --platform=linux/<architecture> IMAGE_NAME
in your Dockerfile
.
The default Linux user for these images is heroku
, which does not have root permissions. If you
need to modify locations outside of /home/heroku
or /tmp
you will need to switch back to the
root
user. To do this add USER root
to your Dockerfile
when building images, or pass
--user root
to any docker run
commands.
To learn more about deploying Docker images, please refer to the Heroku Container Registry and Runtime documentation.