简体   繁体   English

在 azure devops 和 azure app services 上配置管道和部署 react app

[英]configure pipelines and deploy react app on azure devops and azure app services

my package.json has the following in scripts section我的 package.json 在脚本部分有以下内容

"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
"lint:check": "eslint . --ext=js,jsx;  exit 0",
"lint:fix": "eslint . --ext=js,jsx --fix;  exit 0",
"build-package-css": "cp src/assets/css/material-dashboard-react.css dist/material-dashboard-react.css",
"build-package": "npm run build-package-css && babel src --out-dir dist"

} }

so do I have to write steps to build pipeline to do all these?那么我是否必须编写步骤来构建管道来完成所有这些工作?

  1. Add npm task and configure the Command install to install npm packages添加npm任务并配置命令install来安装 npm 包
  2. Add task npm, select the command field, choose from the dropdown “custom” and for the command and argument enter run build , we can configure the package.json file in the field Working folder that contains package.json添加任务 npm,选择命令字段,从下拉菜单中选择“custom”,对于command and argument输入run build ,我们可以在Working folder that contains package.json的字段Working folder that contains package.json配置 package.json 文件
  3. Add task CopyFiles , ArchiveFiles and PublishBuildArtifacts to publish artifact.添加任务CopyFilesArchiveFilesPublishBuildArtifacts以发布工件。
  4. Create release pipeline->select the artifact as resource->add task Deploy Azure App Service to deploy your react app to azure app service.创建发布管道-> 选择工件作为资源-> 添加任务Deploy Azure App Service以将您的反应应用程序部署到 azure 应用服务。

Note: We need create app service in the Azure Portal and configure service connect in the project settings.注意:我们需要在 Azure 门户中创建应用服务并在项目设置中配置服务连接。

You can refer to this blog and doc for more details.您可以参考此博客文档了解更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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