From 4ea3bf0f5ee9dfca76a18622d875d01f0f53b048 Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Tue, 4 Oct 2022 23:46:30 -0400 Subject: [PATCH] Add instruction for including/excluding additional files with a Java app Signed-off-by: Daniel Mikusa --- README.md | 5 ++++- buildpack.toml | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c70a2b..21a88d0 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ The buildpack will do the following: * If `/sbt` does not exist * Contributes SBT to a layer with all commands on `$PATH` * Runs `/bin/sbt package` to build the application -* Removes the source code in `` +* Removes the source code in ``, following include/exclude rules * If `$BP_SBT_BUILT_ARTIFACT` matched a single file * Restores `$BP_SBT_BUILT_ARTIFACT` from the layer, expands the single file to `` * If `$BP_SBT_BUILT_ARTIFACT` matched a directory or multiple files @@ -31,6 +31,9 @@ The buildpack will do the following: | `$BP_SBT_BUILT_MODULE` | Configure the module to find application artifact in. Defaults to the root module (empty). | | `$BP_SBT_BUILT_ARTIFACT` | Configure the built application artifact explicitly. Supersedes `$BP_SBT_BUILT_MODULE`. Defaults to `target/universal/*.zip`. Can match a single file, multiple files or a directory. Can be one or more space separated patterns. | | `$BP_SBT_REPOSITORIES_FILE` | Specifies a custom location to SBT's `repositories` file. | +| `$BP_INCLUDE_FILES` | Colon separated list of glob patterns to match source files. Any matched file will be retained in the final image. Defaults to `` (i.e. nothing). | +| `$BP_EXCLUDE_FILES` | Colon separated list of glob patterns to match source files. Any matched file will be specifically removed from the final image. If include patterns are also specified, then they are applied first and exclude patterns can be used to further reduce the fileset. | + ## Bindings The buildpack optionally accepts the following bindings: diff --git a/buildpack.toml b/buildpack.toml index 131a792..1904623 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -53,6 +53,18 @@ api = "0.7" description = "the path to the SBT repositories file" name = "BP_SBT_REPOSITORIES_FILE" + [[metadata.configurations]] + build = true + default = "" + description = "colon separated list of glob patterns, matched source files are included" + name = "BP_INCLUDE_FILES" + + [[metadata.configurations]] + build = true + default = "" + description = "colon separated list of glob patterns, matched source files are removed" + name = "BP_EXCLUDE_FILES" + [[metadata.dependencies]] cpes = ["cpe:2.3:a:lightbend:sbt:1.7.2:*:*:*:*:*:*:*"] id = "sbt"