I'm trying to release a web process into a container by using only the API and not the Heroku CLI.
I know that i can do something like heroku container:release web -a <<myApp>>
, but use the Heroku CLI is not an option since i'm trying to create a GH Action to do it.
After pushing correctly the image in the heroku registry, i tried to release the container doing as stated from the Heroku docs in the following way:
curl -X PATCH https://api.heroku.com/apps/$APP/formation \
-d '{
"updates": [
{
"type": "web",
"docker_image": "$(docker inspect $IMAGE --format={{.Id}})"
}
]
}' \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.heroku+json; version=3.docker-releases" \
-H "Authorization: Bearer $HEROKU_API_KEY"
However it keeps giving me the same message:
{
"resource": "docker_image",
"id": "not_found",
"message": "Couldn't find that docker image."
}
What am i doing wrong?
NOTES:
In my GH Action i already tried doing heroku login -i
and passing username and access token, but it keeps giving me Password: invalid option -s
.
Even if i copy the HEROKU_API_KEY
environment variable, doing docker push ...
fails.
Copying a valid .netrc file fails too with the same error of using the HEROKU_API_KEY
.
If someone gets stuck like me in this i'm posting another solution here.
Create the most simple
heroku.yml
in your repository.Put the following content inside it:
For me, there's no need for run section, since the CMD into the Dockerfile is already what i need to get executed.
In this way, heroku platform understand that must build the image and runs the container after the build process has completed