---
title: Deploying Docker Images to Heroku with CircleCI
description: Learn how to deploy projects to Heroku's, a cloud provider,  with CircleCI which has a free plan and is widely adopted in the open-source community.
image: https://blog.nexton.dev/hubfs/Nxt%20Blog%20-docker-heroku.png
---

[![Nexton Hubspot](https://blog.nexton.dev/hubfs/Nexton%20Hubspot.png)](https://nexton.dev/)

[About](https://www.nexton.dev/about) [Contact](https://www.nexton.dev/#letsTalk) [For Talent](https://www.nexton.dev/talent) [For Companies](https://www.nexton.dev/)

- Menu Item 1 
    - Sub-menu Item 1 
          - Another Item
    - Sub-menu Item 2
- Menu Item 2 
    - Yet Another Item
- Menu Item 3
- Menu Item 4

[ABOUT](https://www.nexton.dev/about)

[CONTACT](https://www.nexton.dev/#letsTalk)

[FOR TALENT](https://www.nexton.dev/talent)

[FOR COMPANIES](https://www.nexton.dev/)

[Technology](https://blog.nexton.dev/tag/technology) - Sun Oct 11 2020

# Deploying Docker Images to Heroku with CircleCI

[![Fabricio Pautasso](https://blog.nexton.dev/hubfs/federico%20pata.png) Fabricio Pautasso](https://blog.nexton.dev/author/fabricio-pautasso)

While the team was working on some proof of concept projects within the company, we needed to deploy those projects to a free cloud provider. During that time we were using AWS for most of our clients, but as these projects were going to be open-source seeds projects, we decided to deploy them on Heroku, which has a free plan and is widely adopted on the open-source community.

[![Circleci docker for software developers](https://images.ctfassets.net/k4d8pgyc7rbq/47M9tUrZNsLP3aTaAAkKrv/176ed38e7dbdc3733ed8d010927c9134/1_Eb-dF845BnJYJwItGje08w.png)](https://images.ctfassets.net/k4d8pgyc7rbq/47M9tUrZNsLP3aTaAAkKrv/176ed38e7dbdc3733ed8d010927c9134/1_Eb-dF845BnJYJwItGje08w.png)

## CircleCI

For all of our projects, we were using CircleCI to develop our CI/CD pipelines. CircleCI is a CI/CD cloud tool that allows us to build, test or deploy our code on every merge or commit, depending on how we configure it.

To start using this tool the process is pretty straightforward, you just need to sign in into the CircleCI site with your GitHub account, and that will detect your GitHub projects. After you are logged in, to start building one of your projects, just go to the Add Projects left tab and choose the project you want to start building.

[![Nexton dashboard on the add projects tap](https://images.ctfassets.net/k4d8pgyc7rbq/2plHpyIWdIVYv4sAoBIUVH/1a5275f3c36c99c2b767db232b66e241/1_MIfyZwvnqxCEAVljM7tExQ.png)](https://images.ctfassets.net/k4d8pgyc7rbq/2plHpyIWdIVYv4sAoBIUVH/1a5275f3c36c99c2b767db232b66e241/1_MIfyZwvnqxCEAVljM7tExQ.png)

That will take you to a new screen where you need to choose the technology of your project and it will give you an example of the config.yml file for that technology.

That file is the CircleCI configuration file that you need to add to your project to be able to be recognized by CircleCI. It needs to be located on a .circleci folder that should be created on your project root folder.

### CI jobs and workflows

After CircleCI initial setup, we will need to start customizing our CircleCI config.yml to setup some build jobs and workflows.

**Jobs**

> Jobs are a collection of Steps. All of the steps in the job are executed in a single unit which consumes a CircleCI container from your plan while it’s running.

After that definition from CircleCI documentation, find below a build job example for a Node.js app:

![code block written by software developer](https://blog.nexton.dev/hs-fs/hubfs/Captura%20de%20Pantalla%202021-06-15%20a%20la(s)%2013.40.32.png?width=1206&name=Captura%20de%20Pantalla%202021-06-15%20a%20la(s)%2013.40.32.png)

 

**Workflows**

> A workflow is a set of rules for defining a collection of jobs and their run order. Workflows support complex job orchestration using a simple set of configuration keys to help you resolve failures sooner.

And a workflow example:

![](https://blog.nexton.dev/hs-fs/hubfs/Captura%20de%20Pantalla%202021-06-15%20a%20la(s)%2013-41-58-png.png?width=1206&name=Captura%20de%20Pantalla%202021-06-15%20a%20la(s)%2013-41-58-png.png)

 

## Heroku

[![Heroku logo](https://images.ctfassets.net/k4d8pgyc7rbq/FLsYl9EslAak7CdzflNqW/fd50938c5d546cf32ccf5cb05846d3c7/0_1JWDyDwHG_mSRZl_.png)](https://images.ctfassets.net/k4d8pgyc7rbq/FLsYl9EslAak7CdzflNqW/fd50938c5d546cf32ccf5cb05846d3c7/0_1JWDyDwHG_mSRZl_.png)

After we have our application builds running, we would need to deploy the app to be able to see it online.

To deploy our Docker image from our development machine, we need to have Heroku CLI installed and the Docker daemon.

First, you will need to create the app in Heroku, using the Heroku web site. After that, you will need to login to Heroku from your terminal or cmd with the following command:

```
heroku login
```

After you run that command, a browser will be opened that takes you to the Heroku web site to authenticate. Once you are done, you will be back to your terminal, logged in.

Then, you will need to login to Heroku container registry:

```
heroku container:login
```

No credentials will be asked at this time. Now, to build our docker image and push it to Heroku, run:

```
heroku container:push -a python-django-starter web
```

You need to have the Dockerfile in project root to be able to build the image. Finally, when the image was pushed successfully, you need to release it:

```
heroku container:release -a python-django-starter web
```

After this last command runs successfully, you will be able to see your app up and running on Heroku.

## Continuous Delivery?

So, previous steps will be deploying our app “manually” into our Heroku account.

[![Circleci graphic for software developers](https://images.ctfassets.net/k4d8pgyc7rbq/3DOhyTmteV7dlQcKxKa3Qv/3ec74cbe318dcd936db53bf345a09b1e/1_Vti3lWnUaeF9iW-LM7f2KA.png)](https://images.ctfassets.net/k4d8pgyc7rbq/3DOhyTmteV7dlQcKxKa3Qv/3ec74cbe318dcd936db53bf345a09b1e/1_Vti3lWnUaeF9iW-LM7f2KA.png)

> But how do we automate this deployment pipeline, to throw a new version of our application every time we merge into a specific git branch? Is possible to automate Heroku CLI login without requiring a browser?

To accomplish all these goals, we will need to create a new job on CircleCI

![Block of code for a Heroku account](https://blog.nexton.dev/hs-fs/hubfs/Captura%20de%20Pantalla%202021-06-15%20a%20la(s)%2013-42-11-png.png?width=1206&name=Captura%20de%20Pantalla%202021-06-15%20a%20la(s)%2013-42-11-png.png)

 

What these commands are doing on the Docker CircleCI build image is

1. Install Heroku CLI on the build machine

```
sudo curl https://cli-assets.heroku.com/install.sh | sh
```

1. Login to Heroku registry passing our Heroku API Key as a parameter to don’t need to authenticate with the Heroku login command. (Bypassing browser login)

```
HEROKU_API_KEY=${HEROKU_TOKEN} heroku container:login
```

1. Building and pushing our docker image to Heroku registry

```
HEROKU_API_KEY=${HEROKU_TOKEN} heroku container:push -a python-django-starter web
```

[How to Optimize Docker Images Using Dive](https://medium.com/nexton/how-to-optimize-docker-images-using-dive-dc590f45dbf5)

1. Releasing the new version of our app

```
HEROKU_API_KEY=${HEROKU_TOKEN} heroku container:release -a python-django-starter web
```

And that’s it, you will have a new version of your app on Heroku after this build run successfully.

But then, from where that HEROKU\_TOKEN is being obtained?

HEROKU\_TOKEN is an environment variable that is defined on CircleCI configuration. You need to go to your project settings, and there is a section where you can set your env variables for it. This env var is going to contain the Heroku API Key for our account, to be able to login to Heroku using the CLI.

To generate that API Key, you need to run the following command

```
heroku authorizations:create
```

That will retrieve a token, that is the one you need to use as your HEROKU\_TOKEN variable.

And that’s it, at this point you will have a complete CI/CD pipeline that can be used to release your containerized application into Heroku using CircleCI as your CI/CD tool.

 

[![How to prepare for an interview with a US company](https://blog.nexton.dev/hs-fs/hubfs/NXT_CTA_0821_BP_3-3.png?width=779&name=NXT_CTA_0821_BP_3-3.png)](https://talent.nextonlabs.com/nail-your-interview-with-a-us-company)

 

 More on [Technology](https://blog.nexton.dev/tag/technology)

[![Fabricio Pautasso](https://blog.nexton.dev/hubfs/federico%20pata.png)](https://blog.nexton.dev/author/fabricio-pautasso)

WRITTEN BY

[Fabricio Pautasso](https://blog.nexton.dev/author/fabricio-pautasso)

**Lead Engineer**   
 I’m interested in challenging projects that allows me to work with emerging technologies.

[Back to the blog](https://blog.nextonlabs.com/)

Recent Posts

## [Nexton joins the Claude Partner Network: what it changes in how we build engineering teams](https://blog.nexton.dev/nexton-joins-the-claude-partner-network-what-it-changes-in-how-we-build-engineering-teams)

## [What Clutch Reviews Reveal About How Nexton Actually Works](https://blog.nexton.dev/what-clutch-reviews-reveal-about-how-nexton-actually-works)

## [What "Nexton AI Ready" Actually Certifies](https://blog.nexton.dev/what-nexton-ai-ready-actually-certifies)

Share It!

![sanity](https://blog.nexton.dev/hubfs/sanity.png)

## 2023 Latin American Tech Salaries and Benefits Trends report

[Unlock insights](https://talent.nextonlabs.com/tech-salaries-and-benefits-trends-report/)

### Our latest posts straight to your inbox:

[Copyright © Nexton 2021 - ALL RIGHTS RESERVED.](https://www.nextonlabs.com/privacy-policy/)

<https://www.linkedin.com/company/nextonlabs> <https://www.facebook.com/nextontalent/> <https://twitter.com/nextonlabs>

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Fabricio Pautasso",
    "url" : "https://blog.nexton.dev/author/fabricio-pautasso"
  },
  "dateModified" : "2023-07-04T12:27:47.866Z",
  "datePublished" : "2020-10-11T14:45:00.000Z",
  "headline" : "Deploying Docker Images to Heroku with CircleCI",
  "image" : [ "https://blog.nexton.dev/hubfs/Nxt%20Blog%20-docker-heroku.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.nexton.dev/deploying-docker-images-to-heroku-with-circleci",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.nexton.dev/hubfs/Nexton%20Hubspot.webp"
    },
    "name" : "Nexton"
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#organization",
  "@type" : "Organization",
  "address" : {
    "@type" : "PostalAddress",
    "addressCountry" : "US",
    "addressLocality" : "Miami",
    "addressRegion" : "FL"
  },
  "aggregateRating" : {
    "@type" : "AggregateRating",
    "bestRating" : "5",
    "itemReviewed" : {
      "@id" : "https://nexton.dev/#organization"
    },
    "ratingCount" : "12",
    "ratingValue" : "4.9",
    "url" : "https://clutch.co/profile/nexton"
  },
  "areaServed" : {
    "@type" : "Country",
    "name" : "United States"
  },
  "description" : "Nexton is a human-powered company building nearshore engineering teams for US companies. Senior Latin American engineers, hand-matched and vetted by engineers. 1,500+ engineers matched with 350+ US companies.",
  "disambiguatingDescription" : "Nearshore technology staffing company (nexton.dev) serving US companies with software engineers from Latin America. Not affiliated with Nexton, the master-planned residential community in Summerville, South Carolina (nexton.com); nor with NEXTON Group, the French digital consulting and IT services company (nexton-group.com); nor with the Navee Nexton electric scooter.",
  "employee" : [ {
    "@id" : "https://nexton.dev/#lucas-arana"
  } ],
  "founder" : [ {
    "@id" : "https://nexton.dev/#diego-sternberg"
  }, {
    "@id" : "https://nexton.dev/#agustin-di-luciano"
  } ],
  "foundingDate" : "2017",
  "knowsAbout" : [ "Nearshore engineering teams", "Software engineering recruiting", "Latin American engineers", "AI engineers" ],
  "legalName" : "Nexton",
  "logo" : "https://nexton.dev/Nexton/nexton-logo.png",
  "makesOffer" : [ {
    "@type" : "Offer",
    "itemOffered" : {
      "@type" : "Service",
      "description" : "Nexton's primary model: embedded, long-term engineering capacity. Nearshore LATAM engineers join the client's team as fully integrated, ongoing members rather than short-term contractors.",
      "name" : "Staff Augmentation"
    }
  }, {
    "@type" : "Offer",
    "itemOffered" : {
      "@type" : "Service",
      "description" : "Direct recruitment of LATAM engineers for full-time positions at US companies, with a technical validation process run by engineers.",
      "name" : "Direct Hiring"
    }
  }, {
    "@type" : "Offer",
    "itemOffered" : {
      "@type" : "Service",
      "description" : "Onboarding LATAM engineers as international team members, with no local legal entity required.",
      "name" : "International Team Member"
    }
  }, {
    "@type" : "Offer",
    "itemOffered" : {
      "@type" : "Service",
      "description" : "Payroll management and legal compliance to hire international talent without administrative friction.",
      "name" : "Payroll Processing (EOR/PEO)"
    }
  } ],
  "name" : "Nexton",
  "numberOfEmployees" : {
    "@type" : "QuantitativeValue",
    "minValue" : 50
  },
  "sameAs" : [ "https://www.linkedin.com/company/nexton", "https://clutch.co/profile/nexton", "https://www.crunchbase.com/organization/nexton-b25a", "https://www.trustpilot.com/review/nexton.dev", "https://www.wikidata.org/wiki/Q140867481", "https://www.inc.com/profile/nexton", "https://blog.nexton.dev/" ],
  "slogan" : "Hand-matched Engineers. Vetted by Engineers.",
  "url" : "https://nexton.dev/"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#diego-sternberg",
  "@type" : "Person",
  "jobTitle" : "Co-Founder & CEO",
  "name" : "Diego Sternberg",
  "sameAs" : [ "https://www.linkedin.com/in/diegosternberg" ],
  "worksFor" : {
    "@id" : "https://nexton.dev/#organization"
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#agustin-di-luciano",
  "@type" : "Person",
  "jobTitle" : "Co-Founder",
  "name" : "Agustín Di Luciano",
  "worksFor" : {
    "@id" : "https://nexton.dev/#organization"
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#lucas-arana",
  "@type" : "Person",
  "jobTitle" : "COO",
  "name" : "Lucas Arana",
  "sameAs" : [ "https://www.linkedin.com/in/lucasarana" ],
  "worksFor" : {
    "@id" : "https://nexton.dev/#organization"
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#website",
  "@type" : "WebSite",
  "description" : "Nearshore tech staffing: hand-matched LATAM engineers, vetted by engineers, for US companies.",
  "inLanguage" : "en",
  "name" : "Nexton",
  "publisher" : {
    "@id" : "https://nexton.dev/#organization"
  },
  "url" : "https://nexton.dev/"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/ai/#webpage",
  "@type" : "WebPage",
  "about" : {
    "@id" : "https://nexton.dev/#organization"
  },
  "description" : "Structured information for LLMs and AI about Nexton: value proposition, services, ICP, competitors, and citable data. Includes links to llms.txt, JSON-LD, and sitemap.",
  "inLanguage" : "en",
  "isPartOf" : {
    "@id" : "https://nexton.dev/#website"
  },
  "name" : "Nexton — AI Hub | Nearshore Tech Staffing",
  "url" : "https://nexton.dev/ai/"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/#salary-report-2026",
  "@type" : "Report",
  "author" : {
    "@id" : "https://nexton.dev/#organization"
  },
  "datePublished" : "2026",
  "description" : "Nexton's proprietary report with compensation data for LATAM software engineers, used as a reference by CTOs and Engineering leaders in the US to plan hiring and budgets.",
  "name" : "Nexton 2026 Salary Report",
  "publisher" : {
    "@id" : "https://nexton.dev/#organization"
  },
  "url" : "https://nexton.dev/salary-report"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://nexton.dev/ai-feed.jsonld#faq",
  "@type" : "FAQPage",
  "mainEntity" : [ {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Nexton is a nearshore tech staffing company that connects US companies with hand-matched LATAM engineers, vetted by engineers, with candidate delivery in 72 hours and hiring in 4 weeks."
    },
    "name" : "What is Nexton?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "For US tech-driven companies, remote-friendly, at Series B+ stage or established, with 50 to 1,000 employees, with buyers such as CTOs, VPs of Engineering, and Engineering Directors, in verticals such as HealthCare, Insurance, and E-Learning."
    },
    "name" : "Who is Nexton for?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Every candidate is technically evaluated by Nexton engineers before being presented to the client, reducing the risk of failed hires compared to traditional staffing processes."
    },
    "name" : "How does the hand-matching process work?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "MatchIQ is Nexton's proprietary AI matching engine, built in-house. It is the methodology behind every Nexton hiring decision rather than a product sold separately. It narrows a database of more than 500,000 LATAM engineers to roughly 500 matching candidates, which then pass three layers of review — MatchIQ matches, handpicked by a recruiter, vetted by an engineer — producing matched and vetted candidates in under 72 hours. Details at https://nexton.dev/matchiq."
    },
    "name" : "What is MatchIQ?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Plans and engagement models (Staff Augmentation, Direct Hiring, International Team Member, Payroll Processing) are quoted based on client needs. For a proposal, reach out via https://nexton.dev."
    },
    "name" : "How much does it cost and how do I get started?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Compared to alternatives such as BairesDev, Toptal, Andela, Turing, Globant, Revelo, Near, or AgileEngine, Nexton stands out for engineer-validated hand-matching, candidate delivery in 72 hours, and a 4-week time-to-hire."
    },
    "name" : "What makes Nexton different from its competitors?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Nexton is US-based, headquartered in Miami, Florida, and specialized in nearshore, sourcing engineers across Latin America."
    },
    "name" : "In which countries or regions does Nexton operate?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "A 4.9/5 rating on Clutch and an active LinkedIn presence with nearly 29,000 followers."
    },
    "name" : "What certifications or recognitions does Nexton have?"
  }, {
    "@type" : "Question",
    "acceptedAnswer" : {
      "@type" : "Answer",
      "text" : "Yes. Nexton publishes an annual Salary Report with LATAM engineer compensation data, used as a reference by Engineering leaders in the US. Available at https://nexton.dev/salary-report."
    },
    "name" : "Does Nexton publish proprietary market data?"
  } ]
}
```