首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >fly.io上对Spring应用程序的云本地构建包支持:没有任何构建包组通过检测

fly.io上对Spring应用程序的云本地构建包支持:没有任何构建包组通过检测
EN

Stack Overflow用户
提问于 2022-09-12 10:56:14
回答 1查看 297关注 0票数 1

最近,我发现了fly.io作为Heroku的替代品,在那里他们停下来提供免费的dynos 从11月28日开始。有关于如何使用Deno mit fly.io和Buildpacks的指南,但不是Spring / Java。

我还读过在医生里。他们的builderbuildpacks是这样定义的:

代码语言:javascript
复制
[build]
  builder = "paketobuildpacks/builder:base"
  buildpacks = ["gcr.io/paketo-buildpacks/nodejs"]

因此,对于Spring,我在以下配置中采用了这个方法:

代码语言:javascript
复制
[build]
  builder = "paketobuildpacks/builder:base"
  buildpacks = ["gcr.io/paketo-buildpacks/spring-boot"]

但是,当我运行fly deploy时,正确地加载了构建器,但是在DETECTING阶段,我遇到了以下错误:

代码语言:javascript
复制
$ fly deploy
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-little-silence-4534 ready
==> Building image with Buildpacks
--> docker host: 20.10.12 linux x86_64
base: Pulling from paketobuildpacks/builder
b5da66d4625a: Pulling fs layer
...
4f4fb700ef54: Pull complete
Digest: sha256:bbc26d8b7fe183a1d59fba3e19b55d7a1e647de0bbf5aa14be98e328c4b7d777
Status: Downloaded newer image for paketobuildpacks/builder:base
base-cnb: Pulling from paketobuildpacks/run
b5da66d4625a: Already exists
80857de9da00: Already exists
239caa1e3c6f: Pull complete
ed65ad332a5e: Pull complete
4fe6ac7cc235: Pull complete
Digest: sha256:cfc9b596bedc7bead1b3714a69dffa1fb17fcb1f7bba5c3faadb40c0b6f5acbd
Status: Downloaded newer image for paketobuildpacks/run:base-cnb
latest: Pulling from paketo-buildpacks/spring-boot
3301de03cfeb: Pull complete
Digest: sha256:a6551c90f9af0719233ff4a97408a8ea8054e90f776b592dcbc7f37c03c9518c
Status: Downloaded newer image for gcr.io/paketo-buildpacks/spring-boot:latest
===> DETECTING
ERROR: No buildpack groups passed detection.
ERROR: Please check that you are running against the correct path.
ERROR: failed to detect: no buildpacks participating
Error failed to fetch an image or build from source: executing lifecycle: failed with status code: 20
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-09-12 10:56:14

作为(CNB)的普通用户,我觉得奇怪的是,fly.io文档声明要定义一个buildpacks参数。因为CNB的许多好处之一是,他们正在检测您的应用程序需要什么才能构建。包括所有需要的内置包。因此,只有定义构建器,然后再检测所需的构建包,才有意义。

这也是解决办法。您只需在buildpacks配置中省略build设置。builder标记是我们需要的全部:

代码语言:javascript
复制
[build]
  builder = "paketobuildpacks/builder:base"

这将正确地激活项目的Buildpacks检测,并在fly.io上触发成功的部署。它还将直接将图像推送到位于fly.io的registry.fly.io/microservice-api-spring-boot码头注册中心。下面是一个fly deploy的示例输出

代码语言:javascript
复制
$ fly deploy
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-little-silence-4534 ready
==> Building image with Buildpacks
--> docker host: 20.10.12 linux x86_64
base: Pulling from paketobuildpacks/builder
Digest: sha256:bbc26d8b7fe183a1d59fba3e19b55d7a1e647de0bbf5aa14be98e328c4b7d777
Status: Image is up to date for paketobuildpacks/builder:base
base-cnb: Pulling from paketobuildpacks/run
Digest: sha256:cfc9b596bedc7bead1b3714a69dffa1fb17fcb1f7bba5c3faadb40c0b6f5acbd
Status: Image is up to date for paketobuildpacks/run:base-cnb
===> DETECTING
10 of 24 buildpacks participating
paketo-buildpacks/ca-certificates   3.3.0
paketo-buildpacks/bellsoft-liberica 9.6.1
paketo-buildpacks/syft              1.18.0
paketo-buildpacks/maven             6.7.0
paketo-buildpacks/executable-jar    6.4.0
paketo-buildpacks/apache-tomcat     7.5.0
paketo-buildpacks/apache-tomee      1.2.0
paketo-buildpacks/liberty           2.1.1
paketo-buildpacks/dist-zip          5.3.0
paketo-buildpacks/spring-boot       5.18.0
===> ANALYZING
Previous image with name "registry.fly.io/microservice-api-spring-boot:cache" not found
===> RESTORING
===> BUILDING

Paketo CA Certificates Buildpack 3.3.0
  https://github.com/paketo-buildpacks/ca-certificates
  Launch Helper: Contributing to layer
    Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper

Paketo BellSoft Liberica Buildpack 9.6.1
  https://github.com/paketo-buildpacks/bellsoft-liberica
  Build Configuration:
    $BP_JVM_JLINK_ARGS           --no-man-pages --no-header-files --strip-debug --compress=1  configure custom link arguments (--output must be omitted)
    $BP_JVM_JLINK_ENABLED        false                                                        enables running jlink tool to generate custom JRE
    $BP_JVM_TYPE                 JRE                                                          the JVM type - JDK or JRE
    $BP_JVM_VERSION              11                                                           the Java version
  Launch Configuration:
    $BPL_DEBUG_ENABLED           false                                                        enables Java remote debugging support
    $BPL_DEBUG_PORT              8000                                                         configure the remote debugging port
    $BPL_DEBUG_SUSPEND           false                                                        configure whether to suspend execution until a debugger has attached
    $BPL_HEAP_DUMP_PATH                                                                       write heap dumps on error to this path
    $BPL_JAVA_NMT_ENABLED        true                                                         enables Java Native Memory Tracking (NMT)
    $BPL_JAVA_NMT_LEVEL          summary                                                      configure level of NMT, summary or detail
    $BPL_JFR_ARGS                                                                             configure custom Java Flight Recording (JFR) arguments
    $BPL_JFR_ENABLED             false                                                        enables Java Flight Recording (JFR)
    $BPL_JMX_ENABLED             false                                                        enables Java Management Extensions (JMX)
    $BPL_JMX_PORT                5000                                                         configure the JMX port
    $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
    Using buildpack default Java version 11
  BellSoft Liberica JDK 11.0.16: Contributing to layer
    Downloading from https://github.com/bell-sw/Liberica/releases/download/11.0.16.1+1/bellsoft-jdk11.0.16.1+1-linux-amd64.tar.gz
    Verifying checksum
    Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jdk
    Adding 127 container CA certificates to JVM truststore
    Writing env.build/JAVA_HOME.override
    Writing env.build/JDK_HOME.override
  BellSoft Liberica JRE 11.0.16: Contributing to layer
    Downloading from https://github.com/bell-sw/Liberica/releases/download/11.0.16.1+1/bellsoft-jre11.0.16.1+1-linux-amd64.tar.gz
    Verifying checksum
    Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jre
    Adding 127 container CA certificates to JVM truststore
    Writing env.launch/BPI_APPLICATION_PATH.default
    Writing env.launch/BPI_JVM_CACERTS.default
    Writing env.launch/BPI_JVM_CLASS_COUNT.default
    Writing env.launch/BPI_JVM_SECURITY_PROVIDERS.default
    Writing env.launch/JAVA_HOME.default
    Writing env.launch/JAVA_TOOL_OPTIONS.append
    Writing env.launch/JAVA_TOOL_OPTIONS.delim
    Writing env.launch/MALLOC_ARENA_MAX.default
  Launch Helper: Contributing to layer
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/active-processor-count
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/java-opts
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jvm-heap
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/link-local-dns
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/memory-calculator
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/security-providers-configurer
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jmx
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jfr
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/security-providers-classpath-9
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/debug-9
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/nmt
    Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/openssl-certificate-loader
  Java Security Properties: Contributing to layer
    Writing env.launch/JAVA_SECURITY_PROPERTIES.default
    Writing env.launch/JAVA_TOOL_OPTIONS.append
    Writing env.launch/JAVA_TOOL_OPTIONS.delim

Paketo Buildpack for Syft 1.18.0
  https://github.com/paketo-buildpacks/syft
    Downloading from https://github.com/anchore/syft/releases/download/v0.55.0/syft_0.55.0_linux_amd64.tar.gz
    Verifying checksum
    Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default

Paketo Maven Buildpack 6.7.0
  https://github.com/paketo-buildpacks/maven
  Build Configuration:
    $BP_MAVEN_BUILD_ARGUMENTS  -Dmaven.test.skip=true --no-transfer-progress package  the arguments to pass to Maven
    $BP_MAVEN_BUILT_ARTIFACT   target/*.[ejw]ar                                       the built application artifact explicitly.  Supersedes $BP_MAVEN_BUILT_MODULE
    $BP_MAVEN_BUILT_MODULE                                                            the module to find application artifact in
    $BP_MAVEN_DAEMON_ENABLED   false                                                  use maven daemon
    $BP_MAVEN_POM_FILE         pom.xml                                                the location of the main pom.xml file, relative to the application root
    $BP_MAVEN_SETTINGS_PATH                                                           the path to a Maven settings file
  Apache Maven 3.8.6: Contributing to layer
    Downloading from https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.tar.gz
    Verifying checksum
    Expanding to /layers/paketo-buildpacks_maven/maven
    Creating cache directory /home/cnb/.m2
  Compiled Application: Contributing to layer
    Executing mvn --batch-mode -Dmaven.test.skip=true --no-transfer-progress package
      [INFO] Scanning for projects...
      [INFO]
      [INFO] -------< org.springframework.boot:microservice-api-spring-boot >--------
      [INFO] Building microservice-api-spring-boot 2.7.2
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO]
      [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ microservice-api-spring-boot ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Using 'UTF-8' encoding to copy filtered properties files.
      [INFO] Copying 1 resource
      [INFO] Copying 0 resource
      [INFO]
      [INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ microservice-api-spring-boot ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 6 source files to /workspace/target/classes
      [INFO] /workspace/src/main/java/de/jonashackt/springbootvuejs/configuration/WebSecurityConfiguration.java: /workspace/src/main/java/de/jonashackt/springbootvuejs/configuration/WebSecurityConfiguration.java uses or overrides a deprecated API.
      [INFO] /workspace/src/main/java/de/jonashackt/springbootvuejs/configuration/WebSecurityConfiguration.java: Recompile with -Xlint:deprecation for details.
      [INFO]
      [INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ microservice-api-spring-boot ---
      [INFO] Not copying test resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ microservice-api-spring-boot ---
      [INFO] Not compiling test sources
      [INFO]
      [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ microservice-api-spring-boot ---
      [INFO] Tests are skipped.
      [INFO]
      [INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) @ microservice-api-spring-boot ---
      [INFO] Building jar: /workspace/target/microservice-api-spring-boot-2.7.2.jar
      [INFO]
      [INFO] --- spring-boot-maven-plugin:2.7.2:repackage (repackage) @ microservice-api-spring-boot ---
      [INFO] Replacing main artifact with repackaged archive
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  10.274 s
      [INFO] Finished at: 2022-09-12T10:49:04Z
      [INFO] ------------------------------------------------------------------------

  Removing source code
  Restoring application artifact

Paketo Executable JAR Buildpack 6.4.0
  https://github.com/paketo-buildpacks/executable-jar
  Class Path: Contributing to layer
    Writing env/CLASSPATH.delim
    Writing env/CLASSPATH.prepend
  Process types:
    executable-jar: java org.springframework.boot.loader.JarLauncher (direct)
    task:           java org.springframework.boot.loader.JarLauncher (direct)
    web:            java org.springframework.boot.loader.JarLauncher (direct)

Paketo Buildpack for Spring Boot 5.18.0
  https://github.com/paketo-buildpacks/spring-boot
  Build Configuration:
    $BP_SPRING_CLOUD_BINDINGS_DISABLED   false  whether to contribute Spring Boot cloud bindings support
  Launch Configuration:
    $BPL_SPRING_CLOUD_BINDINGS_DISABLED  false  whether to auto-configure Spring Boot environment properties from bindings
    $BPL_SPRING_CLOUD_BINDINGS_ENABLED   true   Deprecated - whether to auto-configure Spring Boot environment properties from bindings
  Creating slices from layers index
    dependencies (50.6 MB)
    spring-boot-loader (283.6 KB)
    snapshot-dependencies (0.0 B)
    application (71.5 KB)
  Launch Helper: Contributing to layer
    Creating /layers/paketo-buildpacks_spring-boot/helper/exec.d/spring-cloud-bindings
  Spring Cloud Bindings 1.10.0: Contributing to layer
    Downloading from https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.10.0/spring-cloud-bindings-1.10.0.jar
    Verifying checksum
    Copying to /layers/paketo-buildpacks_spring-boot/spring-cloud-bindings
  Web Application Type: Contributing to layer
    Servlet web application detected
    Writing env.launch/BPL_JVM_THREAD_COUNT.default
  4 application slices
  Image labels:
    org.opencontainers.image.title
    org.opencontainers.image.version
    org.springframework.boot.version
===> EXPORTING
Adding layer 'paketo-buildpacks/ca-certificates:helper'
Adding layer 'paketo-buildpacks/bellsoft-liberica:helper'
Adding layer 'paketo-buildpacks/bellsoft-liberica:java-security-properties'
Adding layer 'paketo-buildpacks/bellsoft-liberica:jre'
Adding layer 'paketo-buildpacks/executable-jar:classpath'
Adding layer 'paketo-buildpacks/spring-boot:helper'
Adding layer 'paketo-buildpacks/spring-boot:spring-cloud-bindings'
Adding layer 'paketo-buildpacks/spring-boot:web-application-type'
Adding 5/5 app layer(s)
Adding layer 'launcher'
Adding layer 'config'
Adding layer 'process-types'
Adding label 'io.buildpacks.lifecycle.metadata'
Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
Adding label 'org.opencontainers.image.title'
Adding label 'org.opencontainers.image.version'
Adding label 'org.springframework.boot.version'
Setting default process type 'web'
Saving registry.fly.io/microservice-api-spring-boot:cache...
*** Images (28a69cfce36e):
      registry.fly.io/microservice-api-spring-boot:cache
      registry.fly.io/microservice-api-spring-boot:deployment-01GCRMZ79R99H9RRXFK7H47X3B
Adding cache layer 'paketo-buildpacks/bellsoft-liberica:jdk'
Adding cache layer 'paketo-buildpacks/syft:syft'
Adding cache layer 'paketo-buildpacks/maven:application'
Adding cache layer 'paketo-buildpacks/maven:cache'
Adding cache layer 'paketo-buildpacks/maven:maven'
--> Building image done
==> Pushing image to fly
The push refers to repository [registry.fly.io/microservice-api-spring-boot]
1dc94a70dbaa: Pushed
...
4a641e21953d: Pushed
deployment-01GCRMZ79R99H9RRXFK7H47X3B: digest: sha256:5e77e023b3862ec1edffcee1d78c5b23a5ae6957f6028da0bff16e4b7fd5264f size: 4702
--> Pushing image done
image: registry.fly.io/microservice-api-spring-boot:deployment-01GCRMZ79R99H9RRXFK7H47X3B
image size: 296 MB
==> Creating release
--> release v4 created

--> You can detach the terminal anytime without stopping the deployment
==> Monitoring deployment

 1 desired, 1 placed, 1 healthy, 0 unhealthy [health checks: 1 total, 1 passing]
--> v4 deployed successfully
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73688178

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档