Overview
migetpacks supports multi-buildpack builds for applications that require multiple language runtimes. For example, a Ruby on Rails app that uses Node.js for asset compilation, or a Python app with a Node.js frontend build step.How It Works
Multi-buildpack builds use Docker multi-stage builds to copy runtimes from official images into the primary builder stage. All runtimes are available during the build, and builds run sequentially.Automatic Detection
migetpacks automatically adds Node.js as a secondary buildpack when:- The primary language is not Node.js
- A
package.jsonfile exists in the project root
Automatic Node.js detection only adds Node.js as a secondary buildpack for asset compilation. It does not change the primary language or the runtime base image.
Explicit Buildpack Ordering
Use theBUILDPACKS environment variable to explicitly control which buildpacks run and in what order:
1
First buildpack is the primary language
The first entry determines the base image, runtime container, and main process. In the example above,
ruby is the primary language.2
Subsequent buildpacks add runtimes
Additional entries (
python, nodejs) copy their runtimes into the builder stage and execute their respective build commands.3
Builds run sequentially
Each buildpack’s install and build commands run in order within the same builder stage.
Format
TheBUILDPACKS value accepts both short and namespaced formats:
When
BUILDPACKS is set, automatic detection is disabled. Only the specified buildpacks will be used.Common Use Cases
Ruby + Node.js (Asset Compilation)
Rails apps with Webpack, esbuild, or Vite for JavaScript bundling:npm install or yarn install) and runs the build command (npm run build) before the Ruby app is finalized.
Ruby + Python (AI/ML)
Ruby apps that use Python libraries for machine learning or data processing:Python + Node.js (Frontend Build)
Python API with a Node.js-built frontend:Full Stack Example
Ruby app with Python for AI features and Node.js for assets:Runtime Container
In the final runtime container (non-DHI builds), all secondary runtimes are copied from the builder stage:DHI Limitation
For DHI builds, ensure your application only needs secondary buildpacks at build time (e.g., Node.js for asset compilation that produces static files consumed by the primary runtime).app.json Buildpacks
You can also specify buildpacks viaapp.json:
heroku/ruby becomes ruby).