发布于 2022-10-31 22:06:16
我建议你不要用那个内置包。它是古老的,第三方构建包总是有点问题,即使只是因为它们经常停止更新。
以下是它声称要做的事情:
这是一个Heroku buildpack,用于只从
mysql-client-coredeb包中获取mysql二进制文件。
如果您只需要一个mysql二进制文件,就可以使用apt构建包来安装它,而不用担心apt构建包之类的东西。
Aptfile,列出要安装的Ubuntu软件包。
mysql-client-core-8.0
请注意,buildpack不执行依赖项解析。如果您列出的任何包都有它们自己的依赖项,则可能必须显式地列出它们。您应该会看到列出的Ubuntu包在运行主buildpack之前安装。
无论如何,如果您真的想使您的应用程序与Ruby兼容,那么您应该能够简单地使用在项目的根目录中
只有当应用程序在根目录中有
Gemfile时,Heroku支持才会应用于应用程序。即使应用程序没有创业板依赖项,它也应该包含一个空的Gemfile来记录应用程序没有创业板依赖项。
不需要Gemfile.lock。
请注意,您需要手动添加所需的构建包。我相信您首先需要的是Ruby,然后是问题中的MySQL构建包,然后不管您的应用程序是用什么语言编写的,这似乎是PHP:
heroku buildpacks:set heroku/php # Main buildpack; we insert others before it below
heroku buildpacks:add --index 1 heroku/ruby
heroku buildpacks:add --index 2 https://github.com/thoughtbot/heroku-buildpack-mysql.git
heroku buildpacks
# => Should print the buildpacks in the expected order发布于 2022-11-02 06:04:50
编辑的
事实证明,一个空的Gemfile是不够的,而且实际上也需要一个Gemfile.lock。
-----> Building on the Heroku-22 stack
-----> Using buildpacks:
1. heroku/python
2. heroku/ruby
3. https://github.com/thoughtbot/heroku-buildpack-mysql
4. heroku/php
5. heroku/nodejs
-----> Python app detected
-----> Using Python version specified in runtime.txt
-----> Stack has changed from heroku-20 to heroku-22, clearing cache
-----> No change in requirements detected, installing from cache
-----> Installing python-3.10.8
-----> Installing pip 22.2.2, setuptools 63.4.3 and wheel 0.37.1
-----> Installing SQLite3
-----> Installing requirements with pip
Collecting supervisor
Downloading supervisor-4.2.4-py2.py3-none-any.whl (749 kB)
Installing collected packages: supervisor
Successfully installed supervisor-4.2.4
-----> Ruby app detected
grep: /tmp/build_bebc9aa2/Gemfile.lock: No such file or directory
-----> Compiling Ruby/NoLockfile
!
! Gemfile.lock required. Please check it in.
!
! Push rejected, failed to compile Ruby app.
! Push failed一个空的Gemfile将触发Ruby,但是heroku/ruby包本身会触发一个锁文件。
如果应用程序在根目录中有
Gemfile和Gemfile.lock文件,构建包就会检测到它是Ruby。
经过一些尝试和错误之后,我发现以下文件工作正常:
# Gemfile
source 'https://rubygems.org'# Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
PLATFORMS
ruby
DEPENDENCIES
BUNDLED WITH
1.17.3https://stackoverflow.com/questions/74268864
复制相似问题