gradle spring-boot 2.3.0.M3 buildpack with builder --builder cloudfoundry/cnb:bionic cache jdk 不要在每个 运行 上下载

gradle spring-boot 2.3.0.M3 buildpack with builder --builder cloudfoundry/cnb:bionic cache jdk not to download on every run

我有一个 spring-boot gradle REST 应用程序,想创建一个符合 OCI 的映像 用 https://buildpacks.io/ pack

pack -v build minimal_rest --builder cloudfoundry/cnb:bionic

在任何执行中它都会将 jdk 重新下载为 "Contributing to layer"

===> BUILDING
[builder]
[builder] Cloud Foundry OpenJDK Buildpack v1.2.14
[builder]   OpenJDK JDK 11.0.6: Contributing to layer
[builder]     Downloading from https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.6%!B(MISSING)10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.6_10.tar.gz

有没有办法 "cache" 贡献层,这样它们就不会在每个 运行 上重新下载?

加上:

我使用 spring-boot-starter-2.3.0.M3 和 gradle 6.2.1 与 org.springframework.boot 插件(还有 v 2.3.0.M3)

正在通话中

./gradlew clean build -x test bootBuildImage

tasks {
    bootJar {
        val archivesBaseName: String by project.extra
        archiveBaseName.set(archivesBaseName)
        manifest {
            attributes["Implementation-Title"] = project.name
            attributes["Implementation-Version"] = v.version
            attributes["provider"] = "gradle"
        }
    }
    bootBuildImage {
        builder = "cloudfoundry/cnb:bionic"
        val archivesBaseName: String by project.extra
        imageName = archivesBaseName
    }
}

我终于明白了:

Execution failed for task ':bootBuildImage'.
> Detected platform API version 'v0.3' is not included in supported versions 'v0.1,v0.2'

但使用的 cloudfoundry/cnb:bionic 刚诞生 2 天(2020 年 3 月 20 日)

也许对此有什么想法?

所以我在他们的 Slack 频道上得到了答案(至少第一部分是这样)。

在使用 --clear-cache 进行无错误 运行 之后...包现在缓存 jdk 并且不会在每个 运行 上下载 jdk . (肯定不会连续 运行s 传递 --clear-cache)

此外,在您的项目根目录中,您可以询问 pack 本身 "recommends" 哪些构建器具有:

$ pack suggest-builders
Suggested builders:
    Cloud Foundry:     cloudfoundry/cnb:bionic         Ubuntu bionic base image with buildpacks for Java, NodeJS and Golang
    Cloud Foundry:     cloudfoundry/cnb:cflinuxfs3     cflinuxfs3 base image with buildpacks for Java, .NET, NodeJS, Python, Golang, PHP, HTTPD and NGINX
    Cloud Foundry:     cloudfoundry/cnb:tiny           Tiny base image (bionic build image, distroless run image) with buildpacks for Golang
    Heroku:            heroku/buildpacks:18            heroku-18 base image with buildpacks for Ruby, Java, Node.js, Python, Golang, & PHP

Tip: Learn more about a specific builder with:
    pack inspect-builder [builder image]
```