SpringBootアプリケーションでCloudNativeBuildpacksのビルド時に環境変数を渡すデモ。
具体的には以下の部分でgradle taskに来た環境変数をbuildpackにプロキシしている。
spring-boot-cnbp-demo/build.gradle
Line 27 in d07d067
環境変数の定義についてはbuildpackの定義を参照。
paketoの場合は こちら
$ export BP_IMAGE_LABELS='hogehogetag=test'
$ ./gradlew bootBuildimage
$ docker inspect cnbp-demo:0.0.1-SNAPSHOT | jq '.[0].Config.Labels'
{
...
"hogehogetag": "test",
...
}