如何将新软件安装到GCP灵活环境虚拟机上 [英] How to install new software onto a GCP flexible environment VM

查看:404
本文介绍了如何将新软件安装到GCP灵活环境虚拟机上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用引擎灵活环境中运行的Google Cloud Platform VM上运行Rails应用。它看起来像我在部署应用时使用 gcloud --project项目名称预览应用程序deploy 来安装VM上的大部分软件。我认为它安装了rails和其他软件读取它创建的临时dockerfile。它从app.yaml文件抓取dockerfile的信息(我从他们的教程中获得了这个设置)。

这对我来说工作得很好,但现在我需要将ImageMagick安装到服务器上来操作网站上的图像。通常情况下,您可以通过从项目目录运行 sudo apt-get install imagemagick 来执行此操作。当我SSH到虚拟机上时,我找不到项目目录,因此无法正常工作。



我不知道如何让它每次运行时都运行 sudo apt-get install imagemagick 部署到网站上,以便在新VM上安装软件。



正如你可能能够告诉我对服务器端的东西不太好,想要知道我应该怎么做才能以正确的方式将新软件安装到虚拟机上,所以它总是像ruby和rails等一样。每次我进行新的部署。



要安装ImageMagics,你必须设置<$在你的 app.yaml 中创建一个 runtime:custom ,创建一个 Dockerfile 并添加以下行:

  RUN apt-get update&& \ 
apt-get install imagemagick -y


I have a ruby on rails app running on a Google Cloud Platform VM running on the app engine flexible environment. It looks like it installs most of the software on the VM when I deploy the app with gcloud --project project-name preview app deploy I think it installs rails and other software from reading the temporary dockerfile it creates. It grabs the info for the dockerfile from the app.yaml file (I got this setup from following their tutorials).

This was working fine for me but now I need to install ImageMagick onto the server to manipulate images on the site. Normally you do this by running sudo apt-get install imagemagick from the project directory. When I SSH onto the VM I cant find the project directory so that doesn't work.

I have no idea how to get it to run sudo apt-get install imagemagick each time I make a new deploy to the site so it has the software on the new VM.

As you might be able to tell I'm not very good with the server side of things and want to know what I'm supposed to do to get new software onto the VM the right way so its always there like ruby and rails etc.. are each time I make a new deploy.

解决方案

You should use a custom Dockerfile when you need additional configuration.

To install ImageMagics you have to set runtime: custom in your app.yaml, create a Dockerfile based on default one, and add following line:

RUN apt-get update && \
    apt-get install imagemagick -y

这篇关于如何将新软件安装到GCP灵活环境虚拟机上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆