How to use DigitalOcean’s Container Registry for Continuous Deployment

Guilherme Graca
2 min readDec 5, 2020

At Ripplr, we iterate fast and ship fast. When a feature is ready for the public, it doesn’t stick around waiting for the next official release, we just merge it.

We can do this with great confidence and little risk because our deployment pipeline ensures that the tests pass and that the new version is healthy before it’s made available to users. If the worst happens — we have a 1-click rollback that only takes a few seconds to perform.

All this flexibility is only possible thanks to containerization and automatic image versioning. Our images are all tagged based on the commit SHA.

Tagging Images in Github Actions:

To tag images, we use two marketplace actions:

  • action-doctl — To install doctl and authenticate with DigitalOcean
  • docr-docker-publish — To build, tag and upload the images to DigitalOcean’s Container Registry.

Removing older tags from the Container Registry:

We also remove older images as part of our deployment. It’s improbable that we’ll need something older than the last 10 versions. We do this using docr-image-remove.

Using the new image version:

If you need to perform some tasks with the new image, docr-docker-publish also generates some outputs that we can use on later jobs.

This is what the whole job would look like:

We currently only use this flow in our deploy phase but we expect to extend it to other sections like CI as well as generating staging environments on the fly. Hopefully, these snippets help other devs with a similar stack to ours.

--

--