如何在部署到App Service for Linux时运行自定义部署步骤? [英] How to run custom deployment steps when deploying to App Service for Linux?

查看:110
本文介绍了如何在部署到App Service for Linux时运行自定义部署步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我对网站感到困惑,不知道在哪里提问,所以我把它放在这里:

https:// feedback。 azure.com/forums/169385-web-apps/suggestions/36805318-how-to-run-custom-deployment-steps-when-deploying



但我认为这个地方更合适。 (我没有在这个上看到论坛的链接 网站,但也许我错过了它))b


无论如何,这里是我在那里发布的内容的副本:


---



我正在尝试将nodejs应用程序部署到具有自定义构建步骤的azure。



我希望部署运行: 

npm install 

npm build 

部署后



它似乎只运行`npm install --production`然后尝试运行package.json的`main`字段中列出的文件。虽然源是打字稿,所以我会需要先编译它,因此需要运行自定义部署步骤。我可以在本地压缩
整个构建文件夹但这需要很长时间。



我在这里看到: 

https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script



你可以添加`.deployment`文件来调用`deploy.cmd`文件来执行命令。



我安装了` kuduscript `,生成了文件,并使用正确的方式对其进行了编辑命令,但在部署到适用于Linux的App Service时似乎没有运行它们。



我也使用Azure App Service VSCode扩展进行部署,所以我不知道是否会导致奇怪。



我已尝试部署到常规/旧应用服务(非Linux容器),它似乎运行步骤并按预期部署。



部署到Linux时,它说: 

``` 

2019-02- 09T20:22:22.401Z - 生成部署脚本。 

2019-02-09T20:22:22.709Z - 使用以下命令生成部署脚本:'azure site deploymentscript -y --no-dot-deployment -r" / tmp / zipdeploy / extracted" -o" / home / site / deployments / tools" --basic --sitePath" / tmp / zipdeploy / extracted"'。 

2019-02-09T20:22:24.956Z - 为网站生成部署脚本 

2019-02-09T20:22:24.983Z - 生成的部署脚本文件 

2019-02-09T20:22:26.768Z - 运行部署命令... 

2019-02 -09T20:22:26.782Z - 命令:" /home/site/deployments/tools/deploy.sh" 

2019-02-09T20:22:28.529Z - 处理基本网站部署。 

在Windows上部署时,它说: 

2019-02-09T21:09:35.035Z - 运行自定义部署命令... 

2019-02-09T21 :09:35.160Z - 运行部署命令... 

2019-02-09T21:09:35.160Z - 命令:deploy.cmd 

2019-02-09T21:09:37.942Z - 处理node.js部署。 



```



哪个正确运行我的`deploy.sh`,它添加了'npm run build'步骤。





如何在部署到App Service for Linux时运行部署步骤而不是默认脚本?








$

解决方案

感谢您报告此问题!
你可以直接在这里分享你的WebApp名称吗?
间接



反馈论坛(UserVoice)
https: //feedback.azure.com/forums/34192--general-feedback ,用于根据您使用Azure的体验接收任何建议,想法或反馈。 ll您分享的反馈$ b这些论坛上的$ b将由负责构建Azure的Microsoft工程团队进行监控和审核。具有类似问题的用户也可以提交相关的帖子/反馈。


Hi,

I had been confused about the website and didn't know where to ask the question so I put it here:
https://feedback.azure.com/forums/169385-web-apps/suggestions/36805318-how-to-run-custom-deployment-steps-when-deploying

but I think this place is more appropriate. (I didn't see a link to the forums on this site, but maybe I missed it)

Anyways here is copy of what I posted over there:

---

I am trying to deploy a nodejs app to azure which has custom build steps.

I would like the deployment to run: 
npm install 
npm build 
After it's deployed

It seems it only runs `npm install --production` and then tries to run the file listed in the `main` field of package.json. Although the source is in typescript so I would need to compile it first hence the need to run custom deploy step.  I could zip the whole build folder locally but that takes a long time.

I saw here: 
https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script

That you can add a `.deployment` file to call `deploy.cmd` file which will execute commands.

I installed `kuduscript`, generated the files, and edited them with the correct command but they don't seem to be run when deploying to an App Service for Linux.

I'm also deploying using the Azure App Service VSCode extension so I don't know if that is causing the oddity.

I have tried deploying to a regular / old App Service (Not Linux Container) and it seems to run the steps and deploy as expected.

When deploying to Linux it says: 
``` 
2019-02-09T20:22:22.401Z - Generating deployment script. 
2019-02-09T20:22:22.709Z - Using the following command to generate deployment script: 'azure site deploymentscript -y --no-dot-deployment -r "/tmp/zipdeploy/extracted" -o "/home/site/deployments/tools" --basic --sitePath "/tmp/zipdeploy/extracted"'. 
2019-02-09T20:22:24.956Z - Generating deployment script for Web Site 
2019-02-09T20:22:24.983Z - Generated deployment script files 
2019-02-09T20:22:26.768Z - Running deployment command... 
2019-02-09T20:22:26.782Z - Command: "/home/site/deployments/tools/deploy.sh" 
2019-02-09T20:22:28.529Z - Handling Basic Web Site deployment. 
```
It looks like it's generating it's own script instead of using the one I checked in the repo. Why?

When deploying on the Windows it says: 
``` 
2019-02-09T21:09:35.035Z - Running custom deployment command... 
2019-02-09T21:09:35.160Z - Running deployment command... 
2019-02-09T21:09:35.160Z - Command: deploy.cmd 
2019-02-09T21:09:37.942Z - Handling node.js deployment. 

```

Which correctly runs my `deploy.sh` which has the `npm run build` step added.


How do I get it to run my deployment steps instead of the default script when deploying to App Service for Linux?


解决方案

Thank you for reporting this issue! could you share your WebApp name directly here or indirectly?

The feedback forum (UserVoice) https://feedback.azure.com/forums/34192--general-feedback, is used to receive any suggestions, idea or feedback based on your experience with Azure. All of the feedback you share on those forums will be monitored and reviewed by the Microsoft engineering teams responsible for building Azure. Users with a similar ask can also upvote a related post/feedback.


这篇关于如何在部署到App Service for Linux时运行自定义部署步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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