首页 > 解决方案 > Heroku 部署继续使用 nodejs 构建,而不是使用 heroku.yml

问题描述

在这里有点吃亏。这是我在日志中得到的:

C:\Users\tzahi\Documents\my-app>git push heroku heroku-fixes-and-repo-cleanup:master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 343 bytes | 343.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. heroku/nodejs
remote:        2. https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
remote:        3. https://github.com/appositum/heroku-buildpack-youtube-dl.git
remote: -----> Node.js app detected

如有必要,我可以发布完整的日志,但“检测到 Node.js 应用程序”似乎出错了。

这是我的根文件夹的样子(请注意,缺少 Procfile):

root
│--heroku.yml
│--Dockerfile.heroku
│--app.json
│--package.json
│   ...

应用程序.json:

{
    "name": "my-app",
    "description": "blah blah blah",
    "repository": "https://github.com/Tzahi12345/my-app",
    "stack": "container",
    "logo": "https://i.imgur.com/GPzvPiU.png",
    "keywords": ["youtube-dl", "youtubedl-material", "nodejs"]
}

heroku.yml:

build:
  docker:
    web: Dockerfile.heroku
  run:
   web: npm start

不确定这run部分是否是必要的,但我暂时把它放在那里(这方面似乎没有太大变化)。

Dockerfile.heroku:

FROM tzahi12345/my-app:my-tag

我努力了:

不知道我要去哪里错了。我假设如果我在根目录中有 heroku.yml 文件,"stack": "container"app.json会检测到它是一个 Docker 容器并正确构建。任何想法/建议将不胜感激!谢谢 :)

编辑:

也许我应该清楚我的最终目标。我想让用户能够使用存储库中的链接部署应用程序,并让构建过程使用 heroku.yml ,如此处所述

标签: herokuheroku-cli

解决方案


推荐阅读