When you select the option to Set up container image automatically, if you do not specify a version in your application’s code, the buildpack will use the latest available version. If you want to use a different language version for your application, you’ll need to set the version in your application’s files.

The method for setting the version varies by language. Below we’ve included examples for currently supported languages.

Ruby

To specify your Ruby version, include the following in your Gemfile:

"https://rubygems.org"
ruby "2.5.1"

NodeJS

To specify your Node.js version and npm version, include the following in your application’s package.json file:

"engines": {
  "node": "^16.14.0",
  "npm": "^8.3.1"
}

Python

To specify your Python version, include the following in your application’s runtime.txt file:

python-3.10.6

Java

To specify your Java version, include the following in your application’s system.properties file:

java.runtime.version=11

Scala

To specify your Scala version, include the following in your application’s build.sbt file:

scalaVersion := "2.13.8"

PHP

To specify your PHP version, include the following in your application’s composer.json file:

{
  "require": {
    "php": "~8.0.0"
  }
}

Go

To specify your Go version, include the following in your application’s go.mod file:

// +heroku goVersion go1.11
go 1.11