在使用 springcloud-kubernetes 项目构建样例时遇到以下报错
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
[creator] Paketo Spring Boot Buildpack 5.3.0
[INFO] [creator] https://github.com/paketo-buildpacks/spring-boot
[INFO] [creator] Creating slices from layers index
[INFO] [creator] dependencies
[INFO] [creator] spring-boot-loader
[INFO] [creator] snapshot-dependencies
[INFO] [creator] application
[INFO] [creator] Launch Helper: Contributing to layer
[INFO] [creator] Creating /layers/paketo-buildpacks_spring-boot/helper/exec.d/spring-cloud-bindings
[INFO] [creator] Spring Cloud Bindings 1.8.0: Contributing to layer
[INFO] [creator] Downloading from https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.8.0/spring-cloud-bindings-1.8.0.jar
[INFO] [creator] unable to invoke layer creator
[INFO] [creator] unable to contribute spring-cloud-bindings layer
[INFO] [creator] unable to get dependency spring-cloud-bindings
[INFO] [creator] unable to download https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.8.0/spring-cloud-bindings-1.8.0.jar
[INFO] [creator] could not download https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.8.0/spring-cloud-bindings-1.8.0.jar: 401
[INFO] [creator] ERROR: failed to build: exit status 1
|
这种报错是因为 springio 的 jar 所在的 repo 不在提供下载支持:
具体参考这个https://spring.io/blog/2022/12/14/notice-of-permissions-changes-to-repo-spring-io-january-2023
github 上也有人体 issue https://github.com/spring-projects/spring-boot/issues/33699
解决办法:
添加 BPL_SPRING_CLOUD_BINDINGS_ENABLED,这个不在进行 springcloudbinding 下载
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
[creator] Paketo Buildpack for Spring Boot 5.26.1
[INFO] [creator] https://github.com/paketo-buildpacks/spring-boot
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_SPRING_CLOUD_BINDINGS_DISABLED false whether to contribute Spring Boot cloud bindings support
[INFO] [creator] Launch Configuration:
[INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_DISABLED false whether to auto-configure Spring Boot environment properties from bindings
[INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_ENABLED false Deprecated - whether to auto-configure Spring Boot environment properties from bindings
[INFO] [creator] Creating slices from layers index
[INFO] [creator] dependencies (41.0 MB)
[INFO] [creator] spring-boot-loader (269.4 KB)
[INFO] [creator] snapshot-dependencies (0.0 B)
[INFO] [creator] application (52.9 KB)
[INFO] [creator] Launch Helper: Contributing to layer
[INFO] [creator] Creating /layers/paketo-buildpacks_spring-boot/helper/exec.d/spring-cloud-bindings
[INFO] [creator] Spring Cloud Bindings 1.13.0: Contributing to layer
[INFO] [creator] Downloading from https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-bindings/1.13.0/spring-cloud-bindings-1.13.0.jar
[INFO] [creator] Verifying checksum
[INFO] [creator] Copying to /layers/paketo-buildpacks_spring-boot/spring-cloud-bindings
[INFO] [creator] Web Application Type: Contributing to layer
[INFO] [creator] Servlet web application detected
[INFO] [creator] Writing env.launch/BPL_JVM_THREAD_COUNT.default
[INFO] [creator] 4 application slices
[INFO] [creator] Image labels:
[INFO] [creator] org.opencontainers.image.title
[INFO] [creator] org.opencontainers.image.version
[INFO] [creator] org.springframework.boot.version
[INFO] [creator] ===> EXPORTING
[INFO] [creator] Adding layer 'paketo-buildpacks/ca-certificates:helper'
[INFO] [creator] Adding layer 'paketo-buildpacks/bellsoft-liberica:helper'
[INFO] [creator] Adding layer 'paketo-buildpacks/bellsoft-liberica:java-security-properties'
[INFO] [creator] Adding layer 'paketo-buildpacks/bellsoft-liberica:jre'
[INFO] [creator] Adding layer 'paketo-buildpacks/executable-jar:classpath'
[INFO] [creator] Adding layer 'paketo-buildpacks/spring-boot:helper'
[INFO] [creator] Adding layer 'paketo-buildpacks/spring-boot:spring-cloud-bindings'
[INFO] [creator] Adding layer 'paketo-buildpacks/spring-boot:web-application-type'
[INFO] [creator] Adding layer 'buildpacksio/lifecycle:launch.sbom'
[INFO] [creator] Adding 5/5 app layer(s)
[INFO] [creator] Adding layer 'buildpacksio/lifecycle:launcher'
[INFO] [creator] Adding layer 'buildpacksio/lifecycle:config'
[INFO] [creator] Adding layer 'buildpacksio/lifecycle:process-types'
[INFO] [creator] Adding label 'io.buildpacks.lifecycle.metadata'
[INFO] [creator] Adding label 'io.buildpacks.build.metadata'
[INFO] [creator] Adding label 'io.buildpacks.project.metadata'
[INFO] [creator] Adding label 'org.opencontainers.image.title'
[INFO] [creator] Adding label 'org.opencontainers.image.version'
[INFO] [creator] Adding label 'org.springframework.boot.version'
[INFO] [creator] Setting default process type 'web'
[INFO] [creator] Saving docker.io/org/kubernetes-leader-election-example:latest...
[INFO] [creator] *** Images (b7a1df1b6136):
[INFO] [creator] docker.io/org/kubernetes-leader-election-example:latest
[INFO] [creator] Adding cache layer 'paketo-buildpacks/syft:syft'
[INFO] [creator] Adding cache layer 'buildpacksio/lifecycle:cache.sbom'
[INFO]
[INFO] Successfully built image 'docker.io/org/kubernetes-leader-election-example:latest'
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:03 min
[INFO] Finished at: 2023-07-26T10:16:19+08:00
[INFO] ------------------------------------------------------------------------
|
pom 文件参考为:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<environmentVariables>
<BP_SPRING_CLOUD_BINDINGS_DISABLED>true</BP_SPRING_CLOUD_BINDINGS_DISABLED>
</environmentVariables>
<image>
<builder>paketobuildpacks/builder:tiny</builder>
<env>
<BP_JVM_VERSION>17</BP_JVM_VERSION>
<BP_MAVEN_BUILD_ARGUMENTS>-DskipTests</BP_MAVEN_BUILD_ARGUMENTS>
<BPL_SPRING_CLOUD_BINDINGS_ENABLED>false</BPL_SPRING_CLOUD_BINDINGS_ENABLED>
<BPL_DEBUG_ENABLED>true</BPL_DEBUG_ENABLED>
</env>
</image>
</configuration>
</plugin>
|
参考
https://github.com/spring-attic/spring-native/issues/1642
支持 arm 构建 springboot-native
https://github.com/spring-attic/spring-native/issues/1642
Thanks for that note @klopfdreh
For anyone else finding their way here:
Everything you love about Spring Native is now baked into Spring Boot 3 which is GA.
The latest version of my “community-provided builder with ARM64” can be found in my fork of dmikusa/paketo-arm64 and it delivers Spring Boot 3 native images for ARM64 & AMD64
minikube docker-conext
eval $(minikube docker-env -u)