Deploy docker container from external registry to Heroku

后端 未结 2 818
深忆病人
深忆病人 2021-02-05 22:50

I got project repository hosted on gitlab. I am using gitlab-ci to build docker container from my project. What I would like to achieve is deploying that container to heroku.

2条回答
  •  离开以前
    2021-02-05 23:20

    The reason for

    "No such image: registry.gitlab.com/username/image:tag"

    error is that tag source should be pulled beforehand. script block should include a docker pull statement. The overall script block should be as follows:

      script:
        - docker login --email=_ --username=_ --password= registry.heroku.com
        - docker pull registry.gitlab.com/maciejsobala/myApp:latest
        - docker tag registry.gitlab.com/maciejsobala/myApp:latest registry.heroku.com/maciejsobala/myApp:latest
        - docker push registry.heroku.com/maciejsobala/myApp:latest
    

    Still this is not enough. Heroku changed its release policy so that pushing to Heroku Container Registry does not trigger a release anymore. Here is the extra command to fulfill the missing release task:

        - docker run --rm -e HEROKU_API_KEY= wingrunr21/alpine-heroku-cli container:release web --app myApp
    

提交回复
热议问题