azure - 尝试在 Azure 上部署无框架静态 Web 应用程序时,为什么我会从 GitHub Actions 收到构建错误?
问题描述
我有一个简单的静态网站,我正在尝试使用 GitHub Actions 将其部署为 Azure 静态 Web 应用程序(无框架)。我的目录结构是:
├── .github/workflows/
├── css/
├── img/
├── js/
├ index.html
当我推送到 GitHub 存储库时,Azure 静态 Web 应用程序 CI/CD 操作会启动构建和部署作业。在 .github/workflows 目录中的 YAML 配置文件中,我为我的存储库/构建配置设置了以下内容:
app_location: "/" # The app source code is in the root directory for the repo
api_location: "" # There is no API that needs to be configured
output_location: "/" # my index.html file is in the root directory for the repo
但是,我在构建和部署作业中收到以下错误:
未能在应用程序工件文件夹 (/) 中找到默认文件。有效的默认文件:index.html,Index.html。如果您的应用程序包含纯静态内容,请验证您的工作流文件(位于 .github/workflows)中的变量“app_location”是否指向应用程序的根目录。
当我指定 index.html 文件的位置时,为什么会出现此错误?
解决方案
因为部署容器是基于 Ubuntu 的,所以我猜测输出位置可能会与整个系统的根目录混淆。
因此,我将工作流 YAML 文件中的输出位置设置为:
output_location: "./"
通过该更改,构建完成并且静态 Web 应用程序成功部署。
推荐阅读
- c# - 我可以使图片与数组中的整数相对应吗?
- powershell - 在 PowerShell v3 中,为什么将表达式的结果存储在不同的对象中?
- r - R中lme4中glmer中的数据大小问题:导致收敛问题的数据集大小
- python - 根据行号删除数据框的行
- http - 如何允许 Expo 发送和接收本地主机?
- r - 如何为 R 中的两个列表运行嵌套 for 循环?
- aframe - 使用 a-link 切换场景会导致浏览器 VR 模式下降
- django - 引用函数中定义的 python 全局变量 --> 从另一个文件
- java - TensorFlow Lite 在机器学习模型处理数值数据方面有用吗?
- angular - 如何在 Angular 指令中获取元素的当前类