Search code examples
azureazure-web-app-servicepublishpolymer-2.xpolymer-starter-kit

Deploying Polymer 2.0 project to Microsoft Azure web app


I have followed basic docs and created a very basic Polymer web app and now I want to deploy it to my Azure Web App. I know VS 2017 provides easy way to just right click and deploy web apps with its built in templates, but in this case I created a project with polymer cli. So I don't really have an option to deploy it that way.

The following is the link of the docs on the page where they explain how to deploy on other platforms: https://www.polymer-project.org/2.0/start/toolbox/deploy


Solution

  • If you are using Git, you're able to deploy the Polymer project to Azure Web App with following steps.

    1. Build your project

    Go to the root of your Polymer app and run the following command:

    polymer build --bundle
    

    2. Commit your content

    • Set up a repository by running the following command under \build\default folder:

      git init
      
    • Use the following command to add files to your repository:

      git add -A
      
    • Next, commit the changes to the repository by using the following command:

      git commit -m "Hello Azure App Service"
      

    3. Follow the steps from this documentation to enable the App Service app repository.

    4. Deploy your project

    • In your app's blade in the Azure Portal, click Settings > Properties for the Git URL.

    • Use git remote to add the remote reference listed in Git URL. Your command will look similar to the following:

      git remote add azure https://<username>@<appname>.scm.azurewebsites.net/<appname>.git
      
    • Push your content to App Service using the new azure remote you just created.

      git push azure master
      

    Now, you can visit your app on the browser.

    enter image description here