在 Heroku 上,如何部署不在 git 存储库根目录中的 Rails 应用程序?

On Heroku, how to deploy Rails app that is not in root directory of git repo?

当 Rails 代码不在 git 存储库的根目录时,如何在 Heroku 上部署 rails 应用程序?

我们希望将几个厚 javascript 客户端引入与我们的 rails 应用程序相同的存储库中,以帮助进行依赖管理和相互关联的构建工具。理想情况下,这将导致 git 存储库的目录结构如下所示:

/repo
  /rails
    /app
    /config
    / ...
  /admin
    /..emberstuff
  /agent
    /..emberstuff

不幸的是,Heroku 默认不支持(据我所知)。

您可以使用 Heroku 中的 Procfile 控制进程的生成方式。你可以在这里看到:https://devcenter.heroku.com/articles/procfile。如果您将 Procfile 提交到您的根目录,这将控制您的应用程序的生成方式。请记住,您也可以在 procfile 中使用 shell。例如:

我的进程:sh -c 'cd ./rails/ && exec name'

按照你上面的结构。

希望对您有所帮助。