【发布时间】:2020-02-08 10:29:46
【问题描述】:
编辑:
在阅读以下所有内容之前,我可以更简洁地问一下为什么 Azure/KuduSync 会忽略我的 .deployment 文件以及如何指示 Kudu 应用服务处理该文件?
我使用 Visual Studio 2017 编写了一个 Node.js/React 项目。当我将它链接到 GitHub 存储库时,它会复制包含 .sln 文件的父目录和包含 node.js 应用程序的项目文件夹。
我遇到的问题是,当我将存储库部署到 Azure 部署槽时,Kudu 将包含 .sln 文件和子文件夹的 GitHub 存储库的根复制到 wwwroot 文件夹。
当我浏览到 Azure 网站时,我必须去
[name].azurewebsite.net/[subfoldername]
访问Index.html。
我尝试使用以下配置创建.deployment 文件:
[config]
project=[subfolder]
我已将它放在我的 GitHub 存储库的根目录中。当我尝试部署时,KuduSync 会忽略 .deployment 文件。
我还尝试创建一个指向子目录的“PROJECT”应用程序设置,并将其标记为我的 Azure Web 应用程序槽中的“部署槽设置”。
这些选项都没有指示 Kudu 直接从子文件夹而不是存储库的根目录进行部署。
[编辑] 这是 GitHub 和 Azure 的目录结构 Snapshots of Directories
[这是来自 Azure 的日志。如您所见,它忽略了 .deployment 文件]
Command: kudusync -v 50 -f /home/site/repository <br/>
-t /home/site/wwwroot <br/>
-n /home/site/deployments/[site]/manifest <br/>
-p /home/site/firstDeploymentManifest <br/>
**-i ".git;.hg;.deployment;.deploy.sh"** <br/>
Kudu sync from: '/home/site/repository' to: '/home/site/wwwroot' <br/>
**Ignoring: .deployment** <br/>
Copying file: '.gitattributes' <br/>
Copying file: '.gitignore' <br/>
【问题讨论】:
-
所以你想把部署项目的默认界面设为index.html?项目中 index.html 文件的路径是什么?
-
您的应用服务实例在哪种操作系统上? Linux 还是 Windows?
-
您好,感谢您的回复。所以我在 Azure 中部署了一个 Linux 容器。我正在使用 Windows 操作系统。所以仓库的结构是: *Root - [Application].sln **[Sub Directory] - Index.html, Server.js, package.json, [folders], [other files]
-
可以显示Server.js的索引代码吗?
-
你的项目根目录下没有index.html,所以需要使用[name].azurewebsite.net/[subfoldername]来访问index.html。对于在 Linux 上运行的应用服务,您可以选择使用 .js 文件来修改默认页面的路径。
标签: linux visual-studio azure github azure-web-app-service