当前位置: 首页 > 知识库问答 >
问题:

使用Dockerfile(IntelliJ)部署Google Flexible App Engine

爱繁
2023-03-14

我从这个“基于Spring Boot的Hello World应用程序”教程开始

https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/helloworld-springboot

我成功地完成了这一任务(并将Hello World应用程序作为一个灵活的应用程序部署到我的GCP项目中)。

然后我将我的所有服务(来自我试图迁移的Java应用程序的服务)添加到这个框架中。

FROM openjdk:8-jre-alpine
RUN mkdir -p src/main/resources/
ADD keyfile.p12 src/main/resources/keyfile.p12
FROM google/cloud-sdk:alpine
RUN apk --update add openjdk8-jre
RUN gcloud components update
runtime: custom
env: flex

runtime_config:  # Optional
  jdk: openjdk8

handlers:
- url: /.*
  script: this field is required, but ignored

manual_scaling:
  instances: 1
[INFO] GCLOUD: cd7100a72410: Layer already exists
[INFO] GCLOUD: d4a58ad5c275: Layer already exists
[INFO] GCLOUD: a2e2afb03734: Pushed
[INFO] GCLOUD: 92624d7e4e7c: Pushed
[INFO] GCLOUD: latest: digest: sha256:c70d801102721c75b862ded5552cb967c1d464e2c02ae0f96129424da8553091 size: 1164
[INFO] GCLOUD: DONE
[INFO] GCLOUD: ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[INFO] GCLOUD: 
[INFO] GCLOUD: Updating service [default] (this may take several minutes)...
[INFO] GCLOUD: ...............................................................................................................................failed.
[INFO] GCLOUD: ERROR: (gcloud.app.deploy) Error Response: [9] 
[INFO] GCLOUD: Application startup error:
[INFO] GCLOUD: 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:41 min
[INFO] Finished at: 2018-08-01T18:04:17+02:00
[INFO] Final Memory: 10M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:2.0.0-rc1:deploy (default-cli) on project iron-dome: Flexible application deployment failed: com.google.cloud.tools.appengine.cloudsdk.process.ProcessHandlerException: com.google.cloud.tools.appengine.api.AppEngineException: Non zero exit: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:2.0.0-rc1:deploy (default-cli) on project iron-dome: Flexible application deployment failed
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Flexible application deployment failed
        at com.google.cloud.tools.maven.AppEngineFlexibleDeployer.deploy(AppEngineFlexibleDeployer.java:52)
        at com.google.cloud.tools.maven.DeployMojo.execute(DeployMojo.java:29)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: com.google.cloud.tools.appengine.api.AppEngineException: com.google.cloud.tools.appengine.cloudsdk.process.ProcessHandlerException: com.google.cloud.tools.appengine.api.AppEngineException: Non zero exit: 1
        at com.google.cloud.tools.appengine.cloudsdk.CloudSdkAppEngineDeployment.deploy(CloudSdkAppEngineDeployment.java:90)
        at com.google.cloud.tools.maven.AppEngineFlexibleDeployer.deploy(AppEngineFlexibleDeployer.java:50)
        ... 23 more
Caused by: com.google.cloud.tools.appengine.cloudsdk.process.ProcessHandlerException: com.google.cloud.tools.appengine.api.AppEngineException: Non zero exit: 1
        at com.google.cloud.tools.appengine.cloudsdk.process.LegacyProcessHandler.handleProcess(LegacyProcessHandler.java:87)
        at com.google.cloud.tools.appengine.cloudsdk.GcloudRunner.run(GcloudRunner.java:96)
        at com.google.cloud.tools.appengine.cloudsdk.CloudSdkAppEngineDeployment.deploy(CloudSdkAppEngineDeployment.java:88)
        ... 24 more
Caused by: com.google.cloud.tools.appengine.api.AppEngineException: Non zero exit: 1
        at com.google.cloud.tools.appengine.cloudsdk.process.NonZeroExceptionExitListener.onExit(NonZeroExceptionExitListener.java:28)
        at com.google.cloud.tools.appengine.cloudsdk.process.LegacyProcessHandler.syncRun(LegacyProcessHandler.java:144)
        at com.google.cloud.tools.appengine.cloudsdk.process.LegacyProcessHandler.handleProcess(LegacyProcessHandler.java:83)
        ... 26 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

共有1个答案

阮选
2023-03-14

与您的dockerfile-multple无关的froms似乎有几个问题;没有entrypoint来运行jar

使用云工具for IntelliJ,我成功地测试了将应用程序部署到app Engine flexible中,并使用生成的jarDockerfile使用以下步骤:

首先重命名当前的Dockerfile,这样我们就可以生成一个新的Dockerfile。然后在Project Structure->Facets->App Engine Flexible下生成一个新的DockerFile

FROM gcr.io/google_appengine/openjdk
# Replace occurrences of YOUR_ARTIFACT_NAME_HERE with the name of the deployed jar
ADD YOUR_ARTIFACT_NAME_HERE.jar /app/
ENTRYPOINT ["/docker-entrypoint.bash"]
CMD ["java","-jar","/app/YOUR_ARTIFACT_NAME_HERE.jar"]
 类似资料:
  • 错误消息:未能部署“Dockerfile:DockerNew”:com。fasterxml。杰克逊。数据绑定。JsonMappingException:数值(4294967295)超出int的范围(-2147483648-2147483647)在[源:(okio.RealBufferedSource$1);行:8,列:34](通过引用链:com.github.dockerjava.api.mode

  • 目前我正在使用JBoss服务器部署我的JavaSpring代码。每次我对代码进行更改时,我所做的是 使用mvn clean install构建项目 将创建的war文件复制到\wildfly-10.1。0\独立\部署 使用$部署/独立的。sh——调试8787 这工作正常,但程序太长。有没有比使用Intellij IDE或其他方法更容易的方法。

  • 本文向大家介绍使用Dockerfile部署nodejs服务的方法步骤,包括了使用Dockerfile部署nodejs服务的方法步骤的使用技巧和注意事项,需要的朋友参考一下 初始化Dockerfile 假设我们的项目名为express,在express项目中创建编辑Dockerfile文件: 这个文件包含了以下命令: FROM node:latest - 指定使用最新版本的node基础镜像 RUN

  • 在Eclipse中,我创建了Tomcat服务器,并将我的应用程序添加到参考资料中。JSP、JS、CSS和JAVA类hot deploy就是这样工作的。 在IntelliJ中,我配置了Tomcat8服务器。在Deployment选项卡中,我添加了我启用了对,还启用了。JSP、JS、CSS热交换就是这样工作的。Java类不是。 我还检查了 我知道我可以使用JRebel,但是在Eclipse中hot d

  • 我们最近从maven迁移到gradle,自迁移以来,我们在部署方面遇到了以下问题。 我们gradle.kts与战争有关的部分如下: 我们可以轻松地部署创建的工件,并在其主机端口上访问其endpoint。 然而,一旦我们部署了辅助工件(在不同的端口上),第一个部署的服务就会突然失败,并出现以下错误: 完整堆栈跟踪如下:https://gist.github.com/knyttl/25711ccd79

  • 在执行这一行时,我总是用代码0退出web_1:mysql-h$mysql_host-u$mysql_user-p$mysql_password$mysql_database 但是,我可以在容器创建后执行docker exec-it<>bash,在那里执行install-sampledata,它就可以工作了 我有这样的docker-compose 和install-sampledata文件