我想在我们的一个项目中使用谷歌云分析器。因为我们使用buildpack来创建我们的docker映像,所以我们不能使用使用dockerfile来添加buildpack的标准方法。
,所以我想知道:如何将构建包添加到我的gradle构建中?
我创建了一个标准的spring引导应用程序,并将buildpack添加到任务中
...
bootBuildImage {
verboseLogging = true
buildpacks = [
"paketo-buildpacks/google-stackdriver"
]
}但是如果我运行构建我就能得到
> Task :bootBuildImage Building image 'docker.io/library/cnb-add-buildpack:0.0.1-SNAPSHOT'
> Pulling builder image 'docker.io/paketobuildpacks/builder:base' ..................................................
> Pulled builder image 'paketobuildpacks/builder@sha256:ac9f318cade49b78c229a8bf7858435514b5573177de2a29d2b30bafd5f0b7ec'
> Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' ..................................................
> Pulled run image 'paketobuildpacks/run@sha256:41ea15b4d591c2722543009fbf8267a13019ecdc8c6a2b4f437ed83ed29bf72c'
> Executing lifecycle version v0.13.3
> Using build cache volume 'pack-cache-fa9655d690f5.build'
> Running creator
[creator] ===> DETECTING
[creator] ======== Results ========
[creator] fail: paketo-buildpacks/google-stackdriver@5.3.1
[creator] ERROR: No buildpack groups passed detection.
[creator] ERROR: Please check that you are running against the correct path.
[creator] ERROR: failed to detect: no buildpacks participating
> Task :bootBuildImage FAILED
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':bootBuildImage'.
> Builder lifecycle 'creator' failed with status code 100
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 44s编辑1:
在添加了一个文件夹/platform/bindings/google-stackdriver,包括一个名为type的文件和内容StackdriverProfiler之后,我仍然可以得到相同的结果。
编辑2:
将该buildpacks从build.gradle中移除并添加我的项目bindings而改为->之后,它起了作用。
因此,您只需要在项目文件夹type中创建一个名为StackdriverProfiler的文件,并在build.gradle中引用该绑定。
bootBuildImage {
verboseLogging = true
bindings = [ "${project.projectDir}/platform/bindings/google-stackdriver:/platform/bindings/google-stackdriver" ]
}发布于 2022-02-09 14:38:26
看来paketo-buildpacks/google-stackdriver的先决条件还没有得到满足。你在这里读到了他们的故事:https://github.com/paketo-buildpacks/google-stackdriver#behavior
一般而言,它要求:
StackdriverDebugger
类型存在绑定
https://stackoverflow.com/questions/71045973
复制相似问题