<p>You can install the Heroku CLI via <code>npm</code> - which might be the simplest. </p>

<p>Note that your Heroku API key has to have the env var name <code>HEROKU_API_KEY</code> for the Heroku CLI to accept it as an auth token (ie. to avoid having to do <code>heroku login</code>). </p>

<pre><code>          - npm install -g heroku

          # build the Docker image (this will use the Dockerfile in the root of the repo)
          - docker build -t $HEROKU_APPLICATION_NAME ./backend
          # authenticate with the Docker Hub registry
          - docker login --username=_ --password $HEROKU_API_KEY registry.heroku.com

          - docker tag $HEROKU_APPLICATION_NAME registry.heroku.com/$HEROKU_APPLICATION_NAME/web
          - docker push registry.heroku.com/$HEROKU_APPLICATION_NAME/web
          - heroku container:release web -a=$HEROKU_APPLICATION_NAME

</code></pre>

CC BY-SA 4.0
2019-12-02T23:34:33.997Z
2019-12-02T23:34:33.997Z
dwjohnston
<p>I have a bitbucket pipeline that almost working: </p>

<pre><code>image: atlassian/default-image:2

pipelines:
  default:
    - step:
        services:
          - docker
        script:      
          #Build the image    
          - docker build -t $IMAGE_NAME ./backend
          #Login to heroku's docker registry with an API token
          - docker login --username=_ --password $HEROKU_TOKEN registry.heroku.com

          #Tag and push our built image to the heroku docker registry
          - docker tag $IMAGE_NAME registry.heroku.com/$HEROKU_APPLICATION_NAME/web
          - docker push registry.heroku.com/$HEROKU_APPLICATION_NAME/web
</code></pre>

<p>The final step is - I would run something like <code>heroku container:release web  -a=$HEROKU_APPLICATION_NAME</code></p>

<p>How can I do that without actually having the heroku-cli (ie. from the bitbucket pipeline). </p>

<continuous-deployment><bitbucket-pipelines>
What's the equivalent of `heroku container:release web` without using heroku-cli?
dwjohnston
# What's the equivalent of `heroku container:release web` without using heroku-cli?

(Asked by: username_0 on 2019-12-02)

I have a bitbucket pipeline that almost working: 
image: atlassian/default-image:2

pipelines:
  default:
    - step:
        services:
          - docker
        script:      
          #Build the image    
          - docker build -t $IMAGE_NAME ./backend
          #Login to heroku's docker registry with an API token
          - docker login --username=_ --password $HEROKU_TOKEN registry.heroku.com

          #Tag and push our built image to the heroku docker registry
          - docker tag $IMAGE_NAME registry.heroku.com/$HEROKU_APPLICATION_NAME/web
          - docker push registry.heroku.com/$HEROKU_APPLICATION_NAME/web

The final step is - I would run something like heroku container:release web  -a=$HEROKU_APPLICATION_NAME
How can I do that without actually having the heroku-cli (ie. from the bitbucket pipeline).

**Tags:** continuous-deployment, bitbucket-pipelines


---

## 1 answers

### Answer by username_0 on 2019-12-02. Score: 1

You can install the Heroku CLI via npm - which might be the simplest. 
Note that your Heroku API key has to have the env var name HEROKU_API_KEY for the Heroku CLI to accept it as an auth token (ie. to avoid having to do heroku login). 
          - npm install -g heroku

          # build the Docker image (this will use the Dockerfile in the root of the repo)
          - docker build -t $HEROKU_APPLICATION_NAME ./backend
          # authenticate with the Docker Hub registry
          - docker login --username=_ --password $HEROKU_API_KEY registry.heroku.com

          - docker tag $HEROKU_APPLICATION_NAME registry.heroku.com/$HEROKU_APPLICATION_NAME/web
          - docker push registry.heroku.com/$HEROKU_APPLICATION_NAME/web
          - heroku container:release web -a=$HEROKU_APPLICATION_NAME


---

