我想使用 Spring Boot 的构建映像目标创建具有不同 JVM 基础的 OCI 映像。但是,我很难找到覆盖 JVM 的文档。谁能告诉我如何只覆盖 JVM 变体“paketo-buildpacks/adoptium”?
我的 pom 文件如下所示。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<builder>jfrog.mycompany.com/paketobuildpacks/builder:base</builder>
<runImage>jfrog.mycompany.com/paketobuildpacks/run:base-cnb</runImage>
</image>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我尝试检查 Spring boot 插件以及 paketo 文档。但没有直接的示例或说明。
我想使用 Nodejs 的 Paketo 构建包创建 Angular 12 应用程序的容器映像。我通过 Angular CLI 创建了该应用程序并对其进行了编码,直到现在我想要部署它。
\n为了创建容器,我按照 paketo 示例存储库中的说明操作并运行以下命令:
\npack build myui --buildpack gcr.io/paketo-buildpacks/nodejs --env "BP_NODE_RUN_SCRIPTS=build" --env "NODE_ENV=development"\nRun Code Online (Sandbox Code Playgroud)\n只要我在运行之前删除 node_modules 目录,这就可以正常工作pack。
现在我想在本地测试图像并尝试启动它
\ndocker run --tty --publish 4200:4200 myui\nRun Code Online (Sandbox Code Playgroud)\n看来启动成功了:
\n\xe2\x9c\x94 Browser application bundle generation complete.\n\nInitial Chunk Files | Names | Size\nmain.js | main | 6.14 MB\nvendor.js | vendor | 4.22 MB\nstyles.css | styles | 159.33 kB\npolyfills.js | polyfills | 128.67 kB\nruntime.js | runtime | 6.56 kB\n\n …Run Code Online (Sandbox Code Playgroud) 我开始使用pack为我的应用程序构建容器映像。我对不同的应用程序使用了不同的构建器:用于 Node.js 应用程序的gcr.io/buildpacks/builder和paketobuildpacks/builder:tiny和用于 Clojure 应用程序的
不必编写 Dockerfile 很棒,但我仍然不确定云原生 Buildpack 是如何工作的。构建包只是一堆可执行文件(由构建器运行),它们与手动编写 Docker多阶段构建FROM(即Dockerfile 中的多个指令)的开发人员实现相同的结果吗?
拥有一个 Spring Boot 应用程序,我尝试使用spring-boot-maven-plugin目标来构建它mvn spring-boot:build-image。但是构建无法下载bellsoft-jre11.0.9.1+1-linux-amd64.tar.gzfrom github.com,因为我无法从构建管道访问它:
...
Paketo BellSoft Liberica Buildpack 5.2.1
https://github.com/paketo-buildpacks/bellsoft-liberica
Build Configuration:
$BP_JVM_VERSION 11.0.9 the Java version
Launch Configuration:
$BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
$BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
$BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
$JAVA_TOOL_OPTIONS the JVM launch flags
BellSoft Liberica JDK 11.0.9: Contributing to layer
Downloading from https://github.com/bell-sw/Liberica/releases/download/11.0.9.1+1/bellsoft-jdk11.0.9.1+1-linux-amd64.tar.gz
unable to invoke layer creator
unable to get …Run Code Online (Sandbox Code Playgroud) 按照此处的建议,这些建议是如何使用 Spring Boot 的 maven 插件将 SSL 证书传递到构建映像中。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<bindings>
<binding>${basedir}/bindings/certificates:/platform/bindings/ca-certificates</binding>
</bindings>
</image>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
project
|-bindings
|-certificates
|-type
|-certificate.crt
Run Code Online (Sandbox Code Playgroud)
$ cat bindings/certificates/type
ca-certificates
Run Code Online (Sandbox Code Playgroud)
$ ./mvnw spring-boot:build-image
...
...
...
[INFO] > Running creator
[INFO] [creator] ===> ANALYZING
[INFO] [creator] Restoring data for SBOM from previous image
[INFO] [creator] ===> DETECTING
[INFO] [creator] ======== Output: paketo-buildpacks/git@1.0.1 ========
[INFO] [creator] failed to load bindings from '/platform/bindings': failed to read binding …Run Code Online (Sandbox Code Playgroud) paketo ×5
buildpack ×4
spring-boot ×3
spring ×2
angular ×1
containers ×1
docker ×1
java ×1
maven ×1
maven-plugin ×1
node.js ×1
pack ×1