|
| 1 | ++++ |
| 2 | +title="Buildpack API 0.7 -> 0.8" |
| 3 | ++++ |
| 4 | + |
| 5 | +<!--more--> |
| 6 | + |
| 7 | +This guide is most relevant to buildpack authors. |
| 8 | + |
| 9 | +See the [spec release](https://github.com/buildpacks/spec/releases/tag/buildpack%2Fv0.8) for buildpack API 0.8 for the full list of changes and further details. |
| 10 | + |
| 11 | +### Process-Specific Working Directory |
| 12 | + |
| 13 | +Buildpacks may specify the working directory for a process by setting the `working-dir` field on the process in [`launch.toml`](https://github.com/buildpacks/spec/blob/buildpack/0.8/buildpack.md#launchtoml-toml). |
| 14 | + |
| 15 | +Prior to this, all processes ran from the app directory (`CNB_APP_DIR`). |
| 16 | +Running a process from a different directory typically involved running a shell to execute a `cd` command and then start the process, like: |
| 17 | + |
| 18 | +``` |
| 19 | +[[processes]] |
| 20 | +command = "bash" |
| 21 | +args = ["-c", "cd <working-dir> && <start-process>"] |
| 22 | +``` |
| 23 | + |
| 24 | +Buildpacks can now specify the process directly with a specific working directory, like: |
| 25 | + |
| 26 | +``` |
| 27 | +[[processes]] |
| 28 | +command = "<start-process>" |
| 29 | +working-dir = "<working-dir>" |
| 30 | +``` |
| 31 | + |
| 32 | +For details, see [RFC 81](https://github.com/buildpacks/rfcs/blob/main/text/0081-process-specific-working-directory.md). |
| 33 | + |
| 34 | +### Deprecate Positional Args to `build` and `detect` Executables |
| 35 | + |
| 36 | +The positional arguments to the `detect` and `build` executables are deprecated. |
| 37 | +The lifecycle now provides these values as environment variables. |
| 38 | + |
| 39 | +To upgrade, buildpack authors should use the following environment variables: |
| 40 | + |
| 41 | +For `detect`: |
| 42 | + |
| 43 | +- `CNB_PLATFORM_DIR` replaces the first positional argument. |
| 44 | +- `CNB_BUILD_PLAN_PATH` replaces the second positional argument. |
| 45 | + |
| 46 | +For `build`: |
| 47 | + |
| 48 | +* `CNB_LAYERS_DIR` replaces the first positional argument. |
| 49 | +* `CNB_PLATFORM_DIR` replaces the second positional argument. |
| 50 | +* `CNB_BP_PLAN_PATH` replaces the third positional argument. |
| 51 | + |
| 52 | +For details, see [RFC 100](https://github.com/buildpacks/rfcs/blob/main/text/0100-buildpack-input-vars.md). |
0 commit comments