gpt4 book ai didi

azure - 如何将 Strapi 部署到 Azure?

转载 作者:行者123 更新时间:2023-12-04 10:02:27 29 4
gpt4 key购买 nike

我在本地安装了 Strapi 和 Mongodb。我需要将其部署到 Azure。Strapi 已在 Azure Git 存储库上提交。我在 Azure 上使用 Ubuntu 创建了一个应用服务。

如何将我的 Strapi 部署到此?我可以使用管道吗?我找不到任何好的文档/示例如何做到这一点。救命!

*************
UPDATE
*************

尝试此处描述的方法后我的结果:

https://github.com/youkou2/Strapi-On-Azure-WebApp

  1. 构建管道工作正常,没有任何错误
  2. 部署管道工作正常,没有任何错误
  3. 已部署的网站为空。

我可以描述我所做的事情,也许有人可以帮助我找出我做错了什么。

a) 构建管道是

pool:
name: Azure Pipelines
steps:
- bash: |
yarn install
set NODE_ENV=PRODUCTION
yarn build

rm -rf .cache
rm -rf .git
displayName: Build

- task: ArchiveFiles@2
displayName: 'Archive ./'
inputs:
rootFolderOrFile: ./
includeRootFolder: false

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'

*** It works ok, no errors ***

b) 部署管道

steps:
- task: AzureRmWebAppDeployment@4
displayName: 'Deploy Azure App Service'
inputs:
azureSubscription: '$(Parameters.ConnectedServiceName)'
appType: '$(Parameters.WebAppKind)'
WebAppName: '$(Parameters.WebAppName)'

*** It works ok, no errors ***

c) 项目部署到 https://oskogencms.azurewebsites.net/

enter image description here

*** It is empty, why? ***
enter code here

以下是有关部署的其他信息:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

最佳答案

您可以尝试使用zip部署,步骤是npm install、创建zip包、发布zip包、发布zip包。欲了解更多信息,请查看官方文档:

https://learn.microsoft.com/en-us/azure/app-service/deploy-zip

顺便说一句,似乎将 Strapi 部署到 Azure Web 应用程序不是推荐的方法。

https://strapi.io/documentation/3.0.0-beta.x/deployment/azure.html#azure

这是一篇关于部署strapi到azure web app的文章,介绍比较详细,也是使用zip部署:(唯一不同的是部署到windows操作系统。如果你可以使用ftp,ftp部署也是一个选择。)

https://github.com/youkou2/Strapi-On-Azure-WebApp

关于azure - 如何将 Strapi 部署到 Azure?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61763170/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com