Question

I have an Azure Website configured to deploy from a Bitbucket repository. This works fine.

Since the application is still in active development, I update the nuget packages it uses quite frequently. This causes the packages folder to keep growing indefinitely, unless I go and manually delete the packages.

Now, in my local machine this is not a big issue. Space is cheap. But in Azure, this makes us go over the quota really fast, as old packages accumulate.

How can I customize the Azure deploy process so that it deletes all the packages after a successful deployment?

(I am open to other solutions as well)

Was it helpful?

Solution

You can utilize the custom deployment script feature where you add a step that cleans up the packages directory.

You can read about it here: http://blog.amitapple.com/post/38418009331/azurewebsitecustomdeploymentpart2/

Another option is to add a post deployment action, by adding a script file (.cmd/.bat) that has the clenup logic to the following directory in your site: d:\home\site\deployments\tools\PostDeploymentActions\, this script will run after the deployment completes successfully.

Read more about it here: https://github.com/projectkudu/kudu/wiki/Post-Deployment-Action-Hooks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top