2
votes

Im trying to set up deployment from my local GIT to my Azure Web App using this guide https://docs.microsoft.com/en-us/azure/app-service/app-service-deploy-local-git

It is pretty straight forward, but I have some issues. This approach deploy my whole repository to the root, and I do not want that.

My Web App is using a CMS, which mean that a lot of files in the Web App is not in my git repo. And also some files in my git repo is not and should not be present in my Web App.

Lets say my Web App looks like this.

  • Root
    • Site
      • System
      • Images
      • Templates

System and Images are not in my git, but Templates are.

This is how my git looks like.

  • Custom code
  • Templates

So when I go ahead and push changes both my Templates and Custom code are deployed into the Root of the Web App.

That is wrong in two ways. First of all I only want to deploy changes in the Templates folder. Second of all I want to deploy the changes into the Site folder not Root.

Is it possible to fix this in some way?

1

1 Answers

2
votes

I had a similar case and I ended up with a workaround.

You have a repository where you store your code (it can be GitHub, BitBucket or any repository which are not supported by Azure). You have Azure Git repository which is used for delivery your code to hosting instance.

My solution was to set up a script which prepares code, create a structure which fits Azure requirements and push it to Azure Git repository.

It works like 1) Compile the application ( I am using .NET) 2) Run HTML and CSS preprocessing with Gulp 3) Publish Web Application to file system 3.1) Do magic with configuration files (when it is required) 4) Copy Published folder to the folder with Azure Git Repository 5) Commit files to Azure Git Repository and Push

You can setup it up with local cmd file or create a script with CI servers like TeamCity or Jenkins triggered by a button click or on code change.