![](/img/trans.png)
[英]Rails with Gcloud ERROR: (gcloud.preview.app.deploy) Error Response: [13] Unexpected Error. Deployed Version:
[英]ERROR: (gcloud.preview.app.deploy) Error Response: [2] Build failed;
我正在運行谷歌應用程序引擎 - 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
任何線索?
修復第一個(如果應用程序中沒有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
在我的情況下,這3個地方(黃色方塊)縮進並不自然地進入下一行.~但在另一個谷歌教程中,沒有這么奇怪的一行,所以在這種情況下我不需要更改“dockerfile”。請參閱dockerfile並檢查下面是否有改變的地方.~
所以我修好了這些奇怪的部分。
在“if”之前,有一個奇怪的行更改,也在“&&”之前。
修復並保存Dockerfile后
我執行了像google指令這樣的命令。
$ RAILS_ENV=production rake assets:precompile
$ gcloud preview app deploy
這就是我所做的一切,我希望它對你有所幫助。
我遇到了與你相同的問題並修復了它。
就我而言,有兩點需要解決。
通過修正這兩點,它已經奏效了。
我將詳細介紹這個程序。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.