Azure App Service Node.js deployment with Kudu serves the public folder rather than the build folder

Luigi Aversa 1 Reputation point
2020-01-05T11:24:09.38+00:00

I just used azure app service with CI/CD to deploy my react application, however I realised that after all the steps kudu serves my application not from the build folder that it has generated, but from my source folder. How I can change to let kudu to serve the build folder?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,694 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Joffrey NURIT 206 Reputation points MVP
    2020-01-05T13:26:04.35+00:00

    Hi @Luigi Aversa ,

    In a "normal way", your app service have only files from your ArtifactStagingDirectory.

    You CI/CD have 2 parts: builds and Reelease management.
    If you have source / build folder on your VM / app service, your error are in Pipeline process.

    A pipeline process work like this:

    • download source
    • execute build (npm install, restore nugget, build for .net / java apps, etc.)
    • Execute tests if you have some
    • The most important: create an artefact and publish

    This artefact are your app files you want to deploy. In my exemple below, you can see i have a build process for my .net core app who set result in artifactstaggingdirectory. The second process make a zip from this directory and publish that. So, in my release management, i have only my artifactstaggingdirectory files.
    It's a good practice. For exemple, a security warning : in source and build files, you have sometimes necessary files for testing, and you don't want to have this files on your production server !

    alt text

    alt text

    I hope i help you. If not, you can sent screen ;)

    0 comments No comments

  2. Luigi Aversa 1 Reputation point
    2020-01-08T11:05:17.843+00:00

    Hi @Joffrey NURIT

    thanks for getting back to me and sorry for the late answer.

    Let me put some context around my question: my case is specific of Azure App Service Node.js deployment on Linux machine. My app is hosted in GitHub, therefore App Service uses Kudu as deployment engine.

    The deployment is successful and the App status is Active and reachable.

    What push me to raise the issue is Azure App Service on Linux machine seems to serve the app from the "/home/site/wwwroot/public" rather than "/home/site/wwwroot/build", the former seems to be the webserver virtualhost and the latter is the result of the node.js built process which in a production environment should be the one reachable from outside because it contains the app itself.

    Please also note that the Azure App Service Setting --> Configuration section is slightly different in this case from any .Net application. Most of the configuration that you can do on the server side for a "typical Microsoft App" are not available for Linux.

    Thanks
    Luigi

    0 comments No comments