Deploy Angular 2 with Azure Webapp

前端 未结 6 913
感动是毒
感动是毒 2020-12-05 05:38

How can can I deploy an angular 2 webapp to azure? I guess I need some type of final compilation script.

Thanks in advance.

6条回答
  •  暖寄归人
    2020-12-05 06:20

    To achieve deploying angular application on azure webapps using bitbucket, create bitbucket-pipelines.yml in root directory. Create environment variables for FTP access for your webapps slot (environment variables are referred using $ in script below).

    Enable the pipelines from Bitbucket settings. That's it. Whenever you check-in the code in specific branch ( master branch in script below), it will deploy the application to azure webapps slot using FTP.

    # registry for your build environment.
    image: node:8.9.0
    
    pipelines:
      branches:
        master:
         - step:
            script: # Modify the commands below to build your repository.
              - npm install -g @angular/cli 
              - npm install
              - ng build --prod
              - apt-get update # Now run the FTP bash script to deploy dist folder to UAT
              - apt-get install ncftp
              - ncftpput -v -u "$FTP_USERNAME" -p $FTP_PASSWORD -R $FTP_HOST $FTP_SITE_ROOT dist/ROOT
              - echo Finished uploading files to $FTP_HOST$FTP_SITE_ROOT
    

提交回复
热议问题