docker-dna

PyPI Badge License Badge Checks Badge

See this project on GitHub. Also available via PyPI.

Motivation

The docker-dna library is a collection of utilities that together simplify the process of deploying webapps inside containers, all the while making sure the process is efficient, customizable, and extensible.

Without docker-dna

The standard procedure for accomplishing the task of deploying webapps inside containers may look something like this:

  1. Copy the relevant files to your webserver

  2. Build and tag the container image

  3. Find an open port on your machine to use in the next step

  4. Run the container image you just built, exposing whatever port the front-end runs on

  5. Write the webserver configuration to proxy your domain endpoint to the port you just exposed

  6. Reload the webserver to host your front-end

  7. Run certbot to get an SSL certificate for your domain endpoint

This sounds tedious, and even if you were to script it, it’d be a lot of scripting to do and chances are it’d be hard to maintain if something goes wrong in the future (which, you know it will in this field of work).

With docker-dna

The process boils down to the following:

  1. Receive a git webhook, and checkout the referenced commit

  2. Call dna.build_image

  3. Figure out what domain(s) you want to deploy this app to

  4. Call dna.run_deploy

That’s it! That handles your first deploy, second deploy, one hundredth deploy… you get the idea.

What you need

To use this library, you need to install docker, nginx, and certbot on your machine. Then, read the quickstart to see an example of how to get up and running with the docker-dna library!

Note

You may also want to check out the Logger class for some logging utilities.