Deploy React on Azure

Register the application service on azure portal

Setup a virtual machine

  • Follow the step to create the agent to run the pipeline

  • Finally, run the shell on background to listen for the job

nohup ./run.sh &

Continuous Integration (CI)

trigger:
- master

pool:
  vmImage: ubuntu-latest
  name: Default
  demands:
  - agent.name -equals myJarvisVm

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '12.0'
  displayName: 'Install Node.js'

- script: |
    npm install
    npm run build
  displayName: 'npm install and build'
  
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'build'
    ArtifactName: 'drop'
    publishLocation: 'Container'
  • Specify the agent that the pipeline run

  • Install NodeJS

  • Install node modules and build

  • Make the build folder as an artifact

Continuous Deployment (CD)

  • Specify which application service to deploy on

  • Specify the artifact folder

  • Specify which agent should be used

  • Specify the startup command to start the application

Result

Last updated

Was this helpful?