gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 18:09:42 25 4
gpt4 key购买 nike

我正在运行 google app engine - ruby​​ on rails 示例一切顺利,直到我必须部署应用程序为止。

google app engine ruby on rails tutorial

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

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

如果你质疑“现在更新?”回答是(是)。然后“app.yaml”文件成为自定义文件,但原始文件保持原样,并制作“dockerfile”。

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

$ gcloud components update

我在下面做了

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

在我的例子中,这 3 个地方(在黄色方 block 中)被缩进并且不自然地转到下一行。~但是在另一个谷歌教程中,没有这样奇怪的行,所以在那种情况下我不需要更改“dockerfile” .请看dockerfile看看下面有没有像我这样改的地方~

Go and check a picture

所以我像这样修复了这些奇怪的部分。

Here is a picture

在“if”之前有一个奇怪的换行,在“&&\”之前也是如此。

修复并保存 Dockerfile 后

我像谷歌指令一样执行了这些命令。

$ RAILS_ENV=production rake assets:precompile


$ gcloud preview app deploy

以上就是我的全部,希望对你有所帮助。

关于ruby-on-rails - ERROR : (gcloud. preview.app.deploy) 错误响应:[2] 构建失败;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36877926/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com