如何通过管道将Strapi部署到Azure

问题描述 投票:0回答:1

我对Strapi相当陌生,这是我第一次部署它。我在MongoDB(Atlas)上有Strapi,它可以在localhost上工作。现在,我要将MongoDb保留在Atlas上,以部署到Azure。

所以我现在的工作是

enter image description here

  1. 认证
  2. npm安装
  3. PowerShell->安装trapi cli并构建我的trapi项目

enter image description here

我在最后一步遇到错误。

enter image description here

我的问题是“是否可以在Azure上使用管道来部署Strapi?”和“有人可以解释我该怎么做吗?”

我将不胜感激!

azure-devops azure-pipelines web-deployment strapi
1个回答
0
投票

以上错误是由于未将bandi安装位置添加到代理计算机的PATH环境变量中引起的。

您将必须将trapdi安装位置添加到PATH环境变量中。

运行脚本任务中的echo "##vso[task.setvariable variable=PATH]${env:PATH};installationFolder"以在托管代理计算机上设置PATH环境变量。在此处查看有关setting variables in scripts的更多信息>

在托管代理上,纱线的默认安装位置为C:\npm\prefix\bin,而不是%LOCALAPPDATA%\Yarn\bin。参见此similar thread

所以powershell脚本看起来像这样echo "##vso[task.setvariable variable=PATH]${env:PATH};C:\npm\prefix\bin"。请参见下面的屏幕截图。

enter image description here

注:

托管代理上的PATH环境变量的更改将仅在以下任务中生效。您需要在单独的powershell任务中运行strapi build。见下文:

在以下PowerShell任务中运行strapi构建

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.