Release container to heroku with Gitlab.ci
Published in
1 min readAug 15, 2018
I recently struggled with adjusting my gitlab-ci.yml to Heroku’s 2 stage deploy process to the container registry.
Previously to deploy a docker container to heroku, you’d only need to run:
$ heroku login
$ heroku container:push web
However heroku changed this process recently to include a heroku container:release web command to allow “multiple images to be released at the same time” (see reference below).
In order to adjust to this change, here’s one way to do it: (gitlab repo)
#.gitlab-ci.yml..............deploy_stage:stage: deploytags:- dockeronly:- masterscript:- docker login --username=_ --password=$HEROKU_API_KEY registry.heroku.com- docker pull $CONTAINER_IMAGE:staging- docker tag $CONTAINER_IMAGE:staging registry.heroku.com/django-cloud/web- docker push registry.heroku.com/django-cloud/web- docker run --rm -e HEROKU_API_KEY=$HEROKU_API_KEY wingrunr21/alpine-heroku-cli container:release web --app django-cloud
Hopefully this will help someone, check out the references to read heroku’s official guide and motivation for this change.