1

I'm trying to configure a review app on Heroku. For every PR, I'd like to deploy and build the Dockerfile, then run my migrations command.

With the below configs, the Dockerfile deploys fine, and the app appears to work as intended.

Dockerfile:

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"
}

But, when I add (what I think is) the release script for migrations, the build fails.

heroku.yml with release script:

release:
  image: Dockerfile
  command:
    - cd ./migrations && ./hasura migrate apply --endpoint $(heroku info -s | grep web_url | cut -d= -f2)

This results in the build error:

=== Fetching app code...
=!= Couldn't find the release image configured for this app. Is there a matching run process?

I've also tried to add a release key to the scripts key in app.json, but this doesn't appear to do anything.

Brandon
  • 6,354
  • 5
  • 39
  • 64

1 Answers1

1

The image parameter shouldn't be the name of your Dockerfile. It should be another image that you built.

In your case, you have a single one:

web: Dockerfile

So you need to specify your release process type like this:

release:
  image: web
  command:
    - cd ./migrations && ./hasura migrate apply --endpoint $(heroku info -s | grep web_url | cut -d= -f2)

Giving you the full heroku.yml as follows:

build:
  docker:
    web: Dockerfile
release:
  image: web
  command:
    - cd ./migrations && ./hasura migrate apply --endpoint $(heroku info -s | grep web_url | cut -d= -f2)

For more information, you can check out the official Heroku documentation on this: https://devcenter.heroku.com/articles/build-docker-images-heroku-yml#release-configuring-release-phase

Damien MATHIEU
  • 29,275
  • 12
  • 79
  • 89