ImageMagick on Google Cloud

后端 未结 1 702
暖寄归人
暖寄归人 2021-01-27 14:25

I use ImageMagick on the Google Cloud Platform. I use rails and Google\'s App Engine Flexible Environment. So the problem is I want to upload an Image to process in more sizes.

相关标签:
1条回答
  • 2021-01-27 14:50

    Okay really simple you need just a 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
    

    After that just run gcloud preview app deploy and it will work for you.

    Don't forget to change in your app.yaml runtime: ruby to runtime: custom

    That's it happy coding

    0 讨论(0)
提交回复
热议问题