【问题标题】:Cannot build using gcloud build command. Gcloud "FAILURE"无法使用 gcloud build 命令进行构建。 Gcloud“失败”
【发布时间】:2021-01-01 08:05:12
【问题描述】:

我正在关注如何在 google cloud run 上设置基本的 hello world 类型应用程序的教程:

https://cloud.google.com/run/docs/quickstarts/build-and-deploy#java

我执行步骤:

gcloud builds submit --tag gcr.io/PROJECT-ID/helloworld

就我而言:

gcloud builds submit --tag gcr.io/whataboutanewproject/helloworld

我得到一个例外

ERROR: (gcloud.builds.submit) build 522dae9a-ddc3-4add-aeb4-f0a542c33649 completed with status "FAILURE"

我的整个堆栈跟踪如下所示:

C:\dev\temp\cloudrun\helloworld>gcloud builds submit --tag gcr.io/whataboutanewproject/helloworld
Creating temporary tarball archive of 13 file(s) totalling 76.4 KiB before compression.
Uploading tarball of [.] to [gs://whataboutanewproject_cloudbuild/source/1600095894.659957-225401928ec54d23ad36d56f150a2040.tgz]
Created [https://cloudbuild.googleapis.com/v1/projects/whataboutanewproject/builds/a71fcef2-d9da-4c6f-a5e8-2b6086c962b2].
Logs are available at [https://console.cloud.google.com/cloud-build/builds/a71fcef2-d9da-4c6f-a5e8-2b6086c962b2?project=825197540625].
------------------------------------------------------------------------------------------------------------ REMOTE BUILD OUTPUT ------------------------------------------------------------------------------------------------------------
starting build "a71fcef2-d9da-4c6f-a5e8-2b6086c962b2"

FETCHSOURCE
Fetching storage object: gs://whataboutanewproject_cloudbuild/source/1600095894.659957-225401928ec54d23ad36d56f150a2040.tgz#1600095896709973
Copying gs://whataboutanewproject_cloudbuild/source/1600095894.659957-225401928ec54d23ad36d56f150a2040.tgz#1600095896709973...
/ [1 files][ 53.1 KiB/ 53.1 KiB]
Operation completed over 1 objects/53.1 KiB.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon  109.6kB
Step 1/8 : FROM maven:3.6-jdk-11 as builder
3.6-jdk-11: Pulling from library/maven
57df1a1f1ad8: Pulling fs layer
71e126169501: Pulling fs layer
1af28a55c3f3: Pulling fs layer
03f1c9932170: Pulling fs layer
881ad7aafb13: Pulling fs layer
9c0ffd4062f3: Pulling fs layer
bd62e479351a: Pulling fs layer
5d4cc47cef87: Pulling fs layer
0c8911cc7703: Pulling fs layer
c19e861fcc5b: Pulling fs layer
03f1c9932170: Waiting
881ad7aafb13: Waiting
9c0ffd4062f3: Waiting
bd62e479351a: Waiting
5d4cc47cef87: Waiting
0c8911cc7703: Waiting
c19e861fcc5b: Waiting
1af28a55c3f3: Verifying Checksum
1af28a55c3f3: Download complete
71e126169501: Verifying Checksum
71e126169501: Download complete
57df1a1f1ad8: Verifying Checksum
57df1a1f1ad8: Download complete
9c0ffd4062f3: Verifying Checksum
9c0ffd4062f3: Download complete
881ad7aafb13: Verifying Checksum
881ad7aafb13: Download complete
03f1c9932170: Verifying Checksum
03f1c9932170: Download complete
5d4cc47cef87: Verifying Checksum
5d4cc47cef87: Download complete
0c8911cc7703: Verifying Checksum
0c8911cc7703: Download complete
c19e861fcc5b: Verifying Checksum
c19e861fcc5b: Download complete
57df1a1f1ad8: Pull complete
71e126169501: Pull complete
1af28a55c3f3: Pull complete
bd62e479351a: Verifying Checksum
bd62e479351a: Download complete
03f1c9932170: Pull complete
881ad7aafb13: Pull complete
9c0ffd4062f3: Pull complete
bd62e479351a: Pull complete
5d4cc47cef87: Pull complete
0c8911cc7703: Pull complete
c19e861fcc5b: Pull complete
Digest: sha256:c3bf5c312b5ad860cfd0b0f7a9b548367fbf2a52a3a786d5ed23742abe2a70db
Status: Downloaded newer image for maven:3.6-jdk-11
 ---> 89d9818b132c
Step 2/8 : WORKDIR /app
 ---> Running in b5b37ac614df
Removing intermediate container b5b37ac614df
 ---> dd90b62db365
Step 3/8 : COPY pom.xml .
COPY failed: stat /var/lib/docker/tmp/docker-builder268680314/pom.xml: no such file or directory
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ERROR: (gcloud.builds.submit) build a71fcef2-d9da-4c6f-a5e8-2b6086c962b2 completed with status "FAILURE"

C:\dev\temp\cloudrun\helloworld>

为什么会这样?

【问题讨论】:

  • 您的构建缺少pom.xml 文件。
  • 确切地说是 Dockerfile 中的这一行 COPY pom.xml - 可能是错误地复制粘贴
  • 谢谢..把它作为答案,我可以给你积分

标签: java google-cloud-platform google-cloud-run


【解决方案1】:

正如 John Hanley 所说,您的构建缺少 pom.xml 文件。

【讨论】:

    猜你喜欢
    • 2021-07-17
    • 2018-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-19
    • 2018-10-05
    相关资源
    最近更新 更多