Kinsta offers Buildpacks, an open-source project maintained by Heroku, as one of the options to automatically determine and create a container for your application based on your repository. Buildpacks are scripts that are run when your application is deployed to install dependencies for your application and configure your environment.
We support the following application languages for Buildpacks:
If you want to use a different language version for your application, you’ll need to set the version in your application’s files.
If you want to use a language that is not a supported Buildpack language, you can first check to see if it’s a supported language with Nixpacks. If it isn’t, you must use a Dockerfile. When you add your application, you can select the Use Nixpacks to set up container image or Use Dockerfile to set up container image option.
Some applications require no configuration, but some require specialized commands and options to run, such as:
Environment variables — You may need to set certain environment variables to run your application.
Processes — Kinsta can automatically detect your web process command. You can change this if required, and you can define additional processes.
Processes in a Procfile — You may want to define your processes in a Procfile within your application’s code.
Add or Edit Buildpacks
You can manage buildpacks on your application’s Settings page. To add additional build packs, click Add buildpack. To remove or change the order of your application’s buildpacks, click Edit buildpacks.
When you add a buildpack, it’s automatically added to the end of the buildpacks list, so you may need to edit the order of your buildpacks. You can drag and drop the buildpacks to change their order in the Edit buildpacks modal/pop-up.
Buildpack Binary Directories
With buildpacks, the binary directories may differ from the default binary directories for the application language. The following table shows the binary directories used for each buildpack language:
|Scala doesn’t have a specific default binary path like some other compiled languages. When you compile a Scala program, it generates bytecode that runs on the Java Virtual Machine (JVM).
The compiled Scala classes are typically stored in a directory structure that mirrors the package structure of your code. This is similar to how Java classes are organized. By default, when you compile a Scala source file, the compiled .class files will be placed in the same directory as the source code (within a subdirectory structure based on the package declarations).
If needed, you can install Scala’s runtime tools using a Dockerfile instead of a buildpack.
|Go doesn’t have a specific default binary path like some other compiled languages. When you compile a Go program, the resulting binary executable is typically placed in the same directory as your source code by default.
If needed, you can install Go’s runtime tools using a Dockerfile instead of a buildpack.
Set a Buildpack’s Language Version
When you select the option to Use Buildpacks to set up container image, 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.
To specify your Go version, include the following in your application’s go.mod file:
// +heroku goVersion go1.11
To specify your Java version, include the following in your application’s system.properties file:
To specify your Node.js and npm versions, include the following in your application’s package.json file:
If you’re using React and want to specify your React version, replace or add the React version in the
dependencies of your package.json file:
To also set the Node.js and npm versions in your React application, include the following in your application’s package.json file:
To specify your PHP version, include the following in your application’s composer.json file:
To specify your Python version, include the following in your application’s runtime.txt file:
You can also specify module versions within the requirements.txt file:
To specify your Ruby version, include the following in your Gemfile:
To specify your Scala version, include the following in your application’s build.sbt file:
scalaVersion := "3.2.2"