This buildpack is meant to be used at the end of the buildpack order definition
and will delete files in the application directory if either
$BP_INCLUDE_FILES
or $BP_EXCLUDE_FILES
.
This buildpack will always pass detection will not delete any files that are in your application directory.There are two ways to control what files are deleted by this buildpack.
If you want a specific subset of files to remain in your buildpacks application
directory flag them to be included using the environment variable
$BP_INCLUDE_FILES
which is a list of globs.
$BP_INCLUDE_FILES=file/glob/*:file/some-file
If you want a specific subset of files to be in your buildpacks application
directory flag them to be included using the environment variable
$BP_EXCLUDE_FILES
which is a list of globs.
$BP_EXCLUDE_FILES=file/glob/*:file/some-file
If both are set then the include logic will run followed by the exclude logic.
To package this buildpack for consumption:
$ ./scripts/package.sh
This builds the buildpack's Go source using GOOS=linux
by default. You can
supply another value as the first argument to package.sh
.
The logic to implement this buildpack is isolated to a package called logic
, which can be used if you want to incorporate the same logic in your buildpack or library. This package does reference packit or libcnb/libpak so it can be used from either style buildpack.
import "github.com/initializ-buildpacks/source-removal/logic"
Then you can run logic.Exclude("foo/*")
or logic.Include("foo/*")
.