0

我在Google雲平臺上使用ImageMagick。我使用Rails和Google的App Engine靈活環境。所以問題是我想上傳一個圖像來處理更多的尺寸。我用回形針。 錯誤是:Google雲上的ImageMagick

無法運行identify命令。請安裝ImageMagick。

所以我的問題是我該如何解決這個問題?上傳未經處理的圖像100%。但問題在於我認爲的處理。所以回形針需要ImageMagick來處理圖像。

問題是我使用App Engine靈活環境,所以我不知道如何安裝它。我已經試過apt-get install imageMagick

回答

0

好吧真的很簡單,你只需要一個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 and foreman gems 
FROM gcr.io/google_appengine/ruby 

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

# To install additional packages needed by your gems, uncomment 
# the "RUN apt-get update" and "RUN apt-get install" lines below 
# and specify your packages. 
# RUN apt-get update 
# RUN apt-get install imagemagick -y 
RUN apt-get update && apt-get install imagemagick -y 

# Install required gems. 
COPY Gemfile Gemfile.lock /app/ 
RUN bundle install && rbenv rehash 

# Start application on port 8080. 
COPY . /app/ 
ENTRYPOINT bundle exec rackup -p 8080 -E production config.ru 

之後,只是運行gcloud preview app deploy它會爲你工作。

不要忘了在app.yamlruntime: rubyruntime: custom

改變就是它編碼快樂