繁体   English   中英

错误:(gcloud.preview.app.deploy)错误响应:[2]构建失败;

[英]ERROR: (gcloud.preview.app.deploy) Error Response: [2] Build failed;

我正在运行谷歌应用程序引擎 - ruby​​ on rails示例一切顺利,我必须部署应用程序。

谷歌应用程序引擎ruby on rails教程

这是导致错误的控制台输出

Beginning deployment...
If this is your first deployment, this may take a while...done.

Verifying that Managed VMs are enabled and ready.
Building and pushing image for service [default]
Started cloud build [c80b8677-2cff-4341-a6f7-b97a55b5fb83].
To see logs in the Cloud Console: https://console.developers.google.com/logs?project=cloud-compute-rails&service=cloudbuild.googleapis.com&key1=c80b8677-2cff-4341-a6f7-b97a55b5fb83&logName=projects/cloud-compute-rails/logs/cloudbuild
----------------------------- REMOTE BUILD OUTPUT ------------------------------
starting build "c80b8677-2cff-4341-a6f7-b97a55b5fb83"

FETCHSOURCE
Fetching storage object: gs://staging.cloud-compute-rails.appspot.com/us.gcr.io/cloud-compute-rails/appengine/default.20160427t004918:latest#1461714651629000
Copying gs://staging.cloud-compute-rails.appspot.com/us.gcr.io/cloud-compute-rails/appengine/default.20160427t004918:latest#1461714651629000...
Downloading file:///tmp/source-archive.tgz:                      0 B/203.33 KiB Downloading file:///tmp/source-archive.tgz:                      72 KiB/203.33 KDownloading file:///tmp/source-archive.tgz:                      144 KiB/203.33 Downloading file:///tmp/source-archive.tgz:                      203.33 KiB/203.33 KiB
FETCHBUILDER
BUILD
+ docker version
Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.3
 Git commit:   a34a1d5
 Built:        Fri Nov 20 17:56:04 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:12:04 UTC 2015
 OS/Arch:      linux/amd64
+ cat Dockerfile
# This Dockerfile for a Ruby application was generated by gcloud.

# The base Dockerfile installs:
# * A number of packages needed by the Ruby runtime and by gems
#   commonly used in Ruby web apps (such as libsqlite3)
# * A recent version of NodeJS
# * A recent version of the standard Ruby runtime to use by default
# * The bundler gem
FROM gcr.io/google_appengine/ruby

# Install 2.2.3
 if not already preinstalled by the base image
RUN cd /rbenv/plugins/ruby-build && \
    git pull && \
    rbenv install -s 2.2.3
 && \
    rbenv global 2.2.3
 && \
    gem install -q --no-rdoc --no-ri bundler --version 1.11
ENV RBENV_VERSION 2.2.3


# Copy the application files.
COPY . /app/

# Install required gems.
RUN bundle install --deployment && rbenv rehash

# BUG: Reset entrypoint to override base image.
ENTRYPOINT []

# Start application on port $PORT.
CMD bundle exec rackup -p 8080 -E production config.ru
+ docker build --tag us.gcr.io/cloud-compute-rails/appengine/default.20160427t004918:latest /workspace
Sending build context to Docker daemon 545.3 kB
Step 1 : FROM gcr.io/google_appengine/ruby
 ---> 3e6d0d6d0575
Step 2 : IF
Unknown instruction: IF
ERROR
ERROR: build step "gcr.io/cloud-builders/dockerizer" failed: exit status 1
ERROR: (gcloud.preview.app.deploy) Error Response: [2] Build failed; check build logs for details

任何线索?

  1. 修复第一个(如果应用程序中没有dockerfile,应该自动生成。)

    转到您未能部署的ruby示例文件。 (我的是“2-cloud-sql”,如下所示)

    $ cd 2-cloud-sql

然后我执行了下一个命令。

$ gcloud preview app gen-config --custom

如果您质疑“立即更新?” 回答y(是)。 然后“app.yaml”文件变为自定义但原始文件保持写入状态,并生成“dockerfile”。

接下来我被要求更新一些Cloud SDK组件,因此请在下面编写命令。

$ gcloud components update

我在下面做了

$ bundle install
  1. 您的示例应用程序中应该已经存在“Dockerfile”。 打开看看。

在我的情况下,这3个地方(黄色方块)缩进并不自然地进入下一行.~但在另一个谷歌教程中,没有这么奇怪的一行,所以在这种情况下我不需要更改“dockerfile”。请参阅dockerfile并检查下面是否有改变的地方.~

去检查图片

所以我修好了这些奇怪的部分。

这是一张照片

在“if”之前,有一个奇怪的行更改,也在“&&”之前。

修复并保存Dockerfile后

我执行了像google指令这样的命令。

$ RAILS_ENV=production rake assets:precompile


$ gcloud preview app deploy

这就是我所做的一切,我希望它对你有所帮助。

我遇到了与你相同的问题并修复了它。

就我而言,有两点需要解决。

  1. Dockerfile已经消失了。(你的样本中是否有Dockerfile下载?)
  2. 在Dockerfile中有一些奇怪的缩进。(也许这会导致ruby版本的差异。)

通过修正这两点,它已经奏效了。

我将详细介绍这个程序。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM