【发布时间】:2020-01-03 07:01:23
【问题描述】:
我正在尝试在 Heroku 上配置评论应用。对于每个 PR,我想部署和构建 Dockerfile,然后运行我的迁移命令。
通过以下配置,Dockerfile 可以正常部署,并且应用程序似乎可以按预期工作。
Docker 文件:
FROM hasura/graphql-engine:v1.0.0-beta.4
ENV HASURA_GRAPHQL_ENABLE_CONSOLE=true
CMD graphql-engine \
--database-url $DATABASE_URL \
serve \
--server-port $PORT
heroku.yml
build:
docker:
web: Dockerfile
app.json
{
"name": "my_project",
"formation": {
"web": {
"quantity": 1,
"size": "free"
}
},
"addons": [
{
"plan": "heroku-postgresql:hobby-dev",
"options": { "version": "9.6" }
}
],
"scripts": {},
"buildpacks": [],
"stack": "container"
}
但是,当我添加(我认为是)用于迁移的发布脚本时,构建失败。
带有发布脚本的heroku.yml:
release:
image: Dockerfile
command:
- cd ./migrations && ./hasura migrate apply --endpoint $(heroku info -s | grep web_url | cut -d= -f2)
这会导致构建错误:
=== Fetching app code...
=!= Couldn't find the release image configured for this app. Is there a matching run process?
我还尝试将release 键添加到app.json 中的scripts 键,但这似乎没有任何作用。
【问题讨论】:
-
把
image: Dockerfile改成image: web看看能不能用? -
你找到答案了吗?我也在使用 Hasura 并遇到同样的问题,建议的答案都不适合我