Azure Web Apps - how to run script before deployment

青春壹個敷衍的年華 提交于 2019-12-12 09:15:17

问题


I'm trying to use Azure Web Apps (Linux) to host a basic static site. I configured everything so a new deployment happens with every Git push. I put my pre-built pages in my repo to confirm everything works fine with this setup.

Now I've removed the pre-built pages and kept only the templates and the build script (which is basically just an npm install and a mustatic 'compile') and I'd like to run this build script in my web app. I've scoured the internet but can't find anything.

How can I run a script upon first deployment and after each Git-push-triggered deployment?


回答1:


How can I run a script upon first deployment and after each Git-push-triggered deployment?

First, you need to generate custom deployment script by using azure-cli tool.

1) Set the cli working mode to asm.

azure config mode asm

2) Run the custom deployment script generator command.

azure site deploymentscript --node -t bash

This will generate the files required to deploy your site.

  • .deployment - Contains the command to run for deploying your site.
  • deploy.sh - Contains the deployment script.

Now you can edit the deploy.cmd file and add your custom steps.

After that done, add the generated files to your repository (.deployment and deploy.sh) and push your repository to your Azure Web App and see your custom deployment running.

For more details, please refer to this blog post.



来源:https://stackoverflow.com/questions/44424129/azure-web-apps-how-to-run-script-before-deployment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!