by charitywater
GitHub Readme.md
Run custom commands during the build process.
This buildpack allows to specify arbitrary commands that will be run in sequence during the build process.
If any command exits with a non-zero code, the build is aborted.
Add the buildpack in addition to any other buildpacks:
heroku buildpacks:add https://github.com/weibeld/heroku-buildpack-run
Set the buildpack as the only buildpack:
heroku buildpacks:set https://github.com/weibeld/heroku-buildpack-run
The commands to run are specified in the BUILDPACK_RUN
config variable by using colons as delimiters.
A command can be anything from a user-provided shell script or binary to a native UNIX command. Commands may have arguments as well.
All commands must be executable. That means, shell scripts must have a shebang line (#!/bin/bash
or similar) and must have the executable bit set (run chmod +x script.sh
on your local machine, then commit and push as usual).
heroku config:set BUILDPACK_RUN='./script.sh:ls -l:bin/myexec foo bar'
git push heroku master
This causes the buildpack to run the following commands in sequence:
./script.sh
ls -l
bin/myexec foo bar
Notes:
./script.sh
is a user-provided shell scriptls -l
refers to the native ls
command on the build dynobin/myexec
is a user-provided binaryIf the BUILDPACK_RUN
config variable is unset, then ./buildpack-run.sh
is used as the default command.
So, if you want to run only a shell script, you can name it buildpack-run.sh
and omit setting the BUILDPACK_RUN
config variable.
Don't forget to make the script executable by running chmod +x buildpack-run.sh
on your local machine, then commit and push as usual.
The following special environment variables are available to your commands during the build:
BUILD_DIR
: absolute path of your app's root directory on the build dynoCACHE_DIR
: cache directory that persists between buildsENV_DIR
: directory containing the values of all config variables in filesBUILD_DIR
corresponds to the working directory during the execution of the buildpack.
Licensed under the MIT License. See LICENSE.md file.
Copy the snippet above into CLI.