简体   繁体   中英

How to deploy nodeJs app from Bitbucket to Azure

Bitbucket has from some time ago availability of Pipelines and I've been strugling, not from the Bitbucket part, but the Azure part as I can't find an easy way to deploy.

in my BitBucket, I have a bitbucket-pipelines.yml with

image: node:8.9.4

pipelines:
  default:
    - step:
        name: Build and test
        caches:
          - node
        script: # install packages and run tests
          - npm install
          - npm test
    - step:
        name: Deploy to Azure
        script:
          - git push https://$AZURE_LOGIN:$AZURE_PASSWORD@$AZURE_APP_NAME.scm.azurewebsites.net/$AZURE_APP_NAME.git master

and all works well from BB part, issue is that the code sent to Azure, from that command line is the application source, and I can't find an easy way to tell Azure to run npm install and I end up with Internal Server Error where a package was not found when I try to run the website after being deployed ...

I've then created a VSTS account to configure Continuous Delivery in both parts... the option CD in Azure portal as well create a pipeline in VSTS...


(through Azure portal directly)


(manually from VSTS)


My question is simple... in order to avoid anything from Azure portal (seems to complicate at the moment, or it's just me as I'm more used to work with AWS and Heroku), is there a way to actually deploy from BitBucket automagically?

How to deploy nodeJs app from Bitbucket to Azure

A simple solution is to use Continuous Deployment, this link has details on how to set up, basically

  1. you choose where your repository lives: 在此处输入图片说明
  2. every time you update your source repo, the change will get pushed to Azure
  3. Azure will then build the new website, which in your case (node environment), npm install will run automatically

I am not sure if you need VSTS, since I imagine that your workflow is something like this (based on my assumption of how CI works)

  1. create pull request, which triggers your bit-bucket pipeline
  2. once build and tests are all successful, you merge your commit
  3. with continuous deployment, Azure will get noticed and update your website

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM